From: Michael D. <svn...@pl...> - 2008-11-23 17:13:52
|
Author: davismr Date: Sun Nov 23 17:13:48 2008 New Revision: 76353 Modified: PloneSurvey/trunk/content/SubSurvey.py PloneSurvey/trunk/content/Survey.py PloneSurvey/trunk/skins/plone_survey/survey_view.cpt PloneSurvey/trunk/skins/plone_survey/validate_survey.vpy Log: Pass the survey id in the form to fix survey respondents with cookies disabled Modified: PloneSurvey/trunk/content/SubSurvey.py ============================================================================== --- PloneSurvey/trunk/content/SubSurvey.py (original) +++ PloneSurvey/trunk/content/SubSurvey.py Sun Nov 23 17:13:48 2008 @@ -38,7 +38,7 @@ """Return the userid for the survey""" request = self.REQUEST try: - user_id = request.form['user_id'] + user_id = request.form['survey_user_id'] except KeyError: pass else: Modified: PloneSurvey/trunk/content/Survey.py ============================================================================== --- PloneSurvey/trunk/content/Survey.py (original) +++ PloneSurvey/trunk/content/Survey.py Sun Nov 23 17:13:48 2008 @@ -308,10 +308,17 @@ security.declareProtected(permissions.View, 'getSurveyId') def getSurveyId(self): """Return the userid for the survey""" + request = self.REQUEST + # Check the request for saving questions on the first survey page + try: + user_id = request.form['survey_user_id'] + except KeyError: + pass + else: + return user_id portal_membership = getToolByName(self, 'portal_membership') if not portal_membership.isAnonymousUser(): return portal_membership.getAuthenticatedMember().getId() - request = self.REQUEST response = request.RESPONSE survey_cookie = self.getId() if self.getAllowAnonymous() and request.has_key(survey_cookie): Modified: PloneSurvey/trunk/skins/plone_survey/survey_view.cpt ============================================================================== --- PloneSurvey/trunk/skins/plone_survey/survey_view.cpt (original) +++ PloneSurvey/trunk/skins/plone_survey/survey_view.cpt Sun Nov 23 17:13:48 2008 @@ -29,6 +29,8 @@ <input type="hidden" name="came_from" tal:attributes="value request/came_from | nothing" tal:condition="request/came_from | nothing" /> + <input type="hidden" name="survey_user_id" + tal:attributes="value context/getSurveyId" /> <fieldset> <legend i18n:translate="legend_question_details">Question details</legend> Modified: PloneSurvey/trunk/skins/plone_survey/validate_survey.vpy ============================================================================== --- PloneSurvey/trunk/skins/plone_survey/validate_survey.vpy (original) +++ PloneSurvey/trunk/skins/plone_survey/validate_survey.vpy Sun Nov 23 17:13:48 2008 @@ -74,5 +74,7 @@ if state.getErrors(): return state.set(status='failure', portal_status_message=_(msgid='text_correct_errors', domain='plonesurvey', default='Please correct the errors shown')) else: - return state.set(status='success') + state.set(status='success') + state.setKwargs({'survey_user_id':form.get('survey_user_id')}) + return state return state |