Index: eUP_SRP/trunk/skins/waeup_custom/logged_in.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.pt	(revision 523)
+++ 	(revision )
@@ -1,120 +1,0 @@
-<metal:html>
-
-<metal:body use-macro="here/main_template/macros/master">
-    
-    <metal:main fill-slot="main"
-                tal:define="p_props here/portal_properties;">
-      <metal:skin tal:condition="exists: here/portal_skins | nothing">
-        <div tal:condition="here/portal_skins/updateSkinCookie | nothing"
-             tal:define="dummy here/setupCurrentSkin">
-        </div>
-      </metal:skin>
-      <tal:block condition="isAnon">
-        <tal:block define="dummy python:request.RESPONSE.expireCookie('__ac',path='/')" />
-          <h1 i18n:translate="heading_login_failure">Login failure</h1>
-          <p>
-            <span i18n:translate="description_login_failure">
-              You are not currently logged in. Your username and or password may be
-              incorrect. Your browser may also not be configured to accept HTTP
-              cookies. If you need help please contact
-            </span>
-            <a href="mailto:admin@here.com" title="Email Admin"
-               tal:attributes="href string:mailto:${p_props/email_from_address}"
-               tal:content="p_props/email_from_address">Email Admin</a>.
-          </p>
-          <p i18n:translate="">
-            help_password_forgotten
-            <tal:block i18n:name="link_password_forgotten"
-                       replace="string:${base_url}account_lost_password_form"/>
-          </p>
-          <p>
-            or <a href="" tal:attributes="href string:${base_url}check_admission">check your admission status</a>
-          </p>
-        </tal:block><!-- isAnon -->
-
-        <tal:block condition="not: isAnon"
-                   define="first_time python:(member.getProperty('login_time', None) ==
-                   here.ZopeTime('2000/01/01'));"
-                   >
-          <span tal:condition="first_time" 
-              tal:define="dummy python: context.process_waeup_login(member=member,sc_pin=request.get('sc_pin',None))" />
-          <tal:block condition="nothing">
-            <div tal:define="now here/ZopeTime;
-            dum_reg python:member.setProperties(last_login_time=now,
-            login_time=now)" />
-            
-            <h1>Welcome!</h1>
-            <p>This is the first time that you've logged in to <span
-                                                                   replace="p_props/title">Here</span>. Before you start exploring you need
-              to change your original password. This will ensure that the password we
-            sent you via email cannot be used in a malicious manner.</p>
-            
-            <p>Please use the form below to change your password.</p>
-
-      <form action="change_password" method="post"
-            tal:attributes="action string:${base_url}change_password">
-        <input type="hidden" name="user" value=""
-               tal:attributes="value member" />
-        <input type="hidden" name="domains:tokens" value="" />
-        <input type="hidden" name="redirect" value=""
-               tal:attributes="value base_url" />
-
-      <table border="1" width="100%" cellspacing="1" cellpadding="1">
-
-       <tr valign="top" align="left">
-         <th>Username</th>
-         <td><span tal:replace="member">You</span></td>
-       </tr>
-
-       <tr valign="top" align="left">
-         <th>New password</th>
-         <td><input type="password" name="password" /></td>
-       </tr>
-
-       <tr valign="top" align="left">
-        <th>Confirm new password</th>
-        <td><input type="password" name="confirm" /></td>
-       </tr>
-
-       <tr>
-        <td></td>
-        <td>
-          <input type="submit" class="standalone" value="Change password" />
-        </td>
-       </tr>
-
-      </table>
-
-      </form>
-
-    </tal:block><!-- first_time -->
-
-    <tal:block condition="not: first_time">
-
-      <tal:block define="d_reg python:member.setProperties(
-                                      last_login_time=member.getProperty('login_time', None));
-                         ereg python:member.setProperties(
-                                     login_time=here.ZopeTime());
-                      "/>
-
-      <div tal:condition="request/came_from | nothing ">
-        <div tal:define="came_from python:request.get('came_from');
-                         response request/RESPONSE;
-                         dredirect python: response.redirect(came_from);
-                        " />
-      </div>
-
-      <h1 i18n:translate="heading_login_success">Login success</h1>
-      <p i18n:translate="description_login_success">
-         Welcome. You are currently logged in.
-      </p>
-
-   </tal:block><!-- not first_time -->
-
-  </tal:block><!-- not isAnon -->
-
-</metal:main>
-
-</metal:body>
-
-</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 524)
+++ /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 524)
@@ -0,0 +1,109 @@
+## Script (Python) "logged_in"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=came_from=None
+##title=
+##
+"""Prepare user login
+modified from cps_default/logged_in.py
+
+$Id: logged_in.py 34693 2006-03-23 17:44:22Z ogrisel $
+"""
+
+from urllib import unquote
+
+def checkRedirect(portal, mtool):
+    to_member_home = False
+    to_workspaces = False
+    has_home = mtool.getHomeFolder()
+    if has_home:
+        to_member_home = True
+    if not has_home and mtool.checkPermission('View', portal.workspaces):
+        to_workspaces = True
+    return to_member_home, to_workspaces
+
+utool = context.portal_url
+mtool = context.portal_membership
+portal = utool.getPortalObject()
+portal_absolute_url = portal.absolute_url()
+
+redirect_url = came_from
+redirect_to_portal = False
+to_member_home = False
+to_workspaces = False
+to_waeup_student_home = False
+
+is_anon = mtool.isAnonymousUser()
+member = mtool.getAuthenticatedMember()
+
+if not redirect_url or redirect_url.endswith('/logged_out'):
+    if not is_anon:
+        if "Student" in member.getRoles():
+            member_id = str(member)
+            student = getattr(context.campus.students,member_id,)
+            if context.portal_workflow.getInfoFor(student,
+                                               'review_state',
+                                               None) == "created":
+                student.content_status_modify(workflow_action="enter_application_pin")
+                da = {}
+                pin = request.get('pin')
+                da['app_ac_pin'] = pin
+                da['app_ac_date'] = current
+                application.getContent().edit(mapping = da)
+                to_waeup_student_home = True
+        elif "Manager" in member.getRoles():
+            pass
+        else:
+            to_member_home, to_workspaces = checkRedirect(portal, mtool)
+    if (not to_member_home) and (not to_workspaces):
+        redirect_to_portal = True
+else:
+    redirect_url = unquote(redirect_url)
+    # One can be redirected from an http page while the login is done from an
+    # https page. This is a fix for #1205.
+    # A better option here would be to replace the previous portal_absolute_url
+    # prefix in the redirect_url by the current portal absolute URL.
+    if not redirect_url.startswith(portal_absolute_url):
+        if not is_anon:
+            to_member_home, to_workspaces = checkRedirect(portal, mtool)
+        if (not to_member_home) and (not to_workspaces):
+            redirect_to_portal = True
+
+if to_waeup_student_home:
+    member.setProperties(last_login_time=current,login_time=current)
+    return response.redirect("%s" % student.absolute_url())
+    
+elif to_member_home:
+    redirect_url = mtool.getHomeFolder().absolute_url()
+elif to_workspaces:
+    redirect_url = portal.workspaces.absolute_url()
+elif redirect_to_portal:
+    redirect_url = portal_absolute_url
+
+REQUEST = context.REQUEST
+RESPONSE = REQUEST.RESPONSE
+
+# Setup skins
+if (getattr(utool, 'updateSkinCookie', False) and
+    utool.updateSkinCookie()):
+    context.setupCurrentSkin()
+
+# Anonymous
+if is_anon:
+    RESPONSE.expireCookie('__ac', path='/')
+    return context.user_logged_in_failed()
+
+login_time = member.getProperty('login_time', '2000/01/01')
+first_time = (str(login_time) == '2000/01/01')
+
+if first_time and member.has_role('Member'):
+    mtool.createMemberArea()
+    now = context.ZopeTime()
+    member.setProperties(last_login_time=now, login_time=now)
+
+if to_member_home or to_workspaces:
+    redirect_url = '%s/?%s' % (redirect_url, 'portal_status_message=psm_logged_in')
+RESPONSE.redirect(redirect_url)
Index: /WAeUP_SRP/trunk/skins/waeup_default/getRenderedWidgets.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/getRenderedWidgets.py	(revision 524)
+++ /WAeUP_SRP/trunk/skins/waeup_default/getRenderedWidgets.py	(revision 524)
@@ -0,0 +1,12 @@
+##parameters=layout
+# $Id: process_waeup_login.py 521 2006-09-14 08:02:57Z joachim $
+"""
+Return the rendered widget as a dict
+
+"""
+dict = {}
+
+for r in layout['rows']:
+    for c in r:
+        dict[c['widget_id']] = c
+return dict
Index: /WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt	(revision 524)
+++ /WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt	(revision 524)
@@ -0,0 +1,29 @@
+<!-- a layout_lib macro -->
+<!-- $Id: layout_lib_default_view.pt 34052 2006-03-06 14:59:24Z atchertchian $ -->
+
+<metal:block define-macro="default_view"
+  tal:define="layout options/layout;
+              dm options/datastructure/getDataModel;
+              widgets python:context.getRenderedWidgets(layout);
+             ">
+             <span tal:condition="nothing" tal:replace="structure widgets" />
+<table width="100%" cellpadding="2" cellspacing="2" summary="layout">
+  <tr tal:repeat="row layout/rows">
+    <td tal:repeat="cell row" tal:attributes="colspan cell/ncols">
+      <tal:block define="widget cell/widget">
+      <div tal:attributes="class cell/widget_css_class|nothing;
+                           id python:widget.getHtmlWidgetId()+'_widget';
+                          ">
+        <tal:block condition="widget/label">
+          <span class="dlabel" i18n:translate="" tal:condition="widget/is_i18n"
+                tal:content="widget/label">label</span>
+          <span class="dlabel" tal:condition="not:widget/is_i18n"
+                tal:content="widget/label">label</span>
+        </tal:block>
+        <tal:block replace="structure cell/widget_rendered" />
+      </div>
+      </tal:block>
+    </td>
+  </tr>
+</table>
+</metal:block>
