EduploneExam/skins/EduploneExam exam_fillgap.pt,1.2,1.3 exam_fillgap_edit.cpt,1.5,1.6 exam_fillgap_process.cpy,1.1,1.2
Nils Haagen <[email protected]> Sat, 02 Apr 2005 21:21:45 +0000
| Newsgroups | gmane.comp.web.zope.eduplone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/eduplone/EduploneExam/skins/EduploneExam
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23588/skins/EduploneExam
Modified Files:
exam_fillgap.pt exam_fillgap_edit.cpt exam_fillgap_process.cpy
Log Message:
fillgap is coming somewhere
Index: exam_fillgap.pt
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/skins/EduploneExam/exam_fillgap.pt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** exam_fillgap.pt 2 Apr 2005 15:07:31 -0000 1.2
--- exam_fillgap.pt 2 Apr 2005 21:21:43 -0000 1.3
***************
*** 9,28 ****
<tal:repeat repeat="word python: currentQuestion.getBasetextAsList()">
! <tal:isGap tal:condition="python: word.startswith('<id=\'') and word.endswith('\'>')"
! tal:define="answerId python:word[5:-2];
! answerObject python:here[answerId];">
<input tal:condition="python: answerObject.portal_type=='BlindGapAnswer'"
tal:attributes="type string:text;
! name python:'name';
! value python:'value';" />
<select tal:condition="python: answerObject.portal_type=='ChoiceGapAnswer'"
! tal:attributes="name python:'name'">
<option tal:repeat="answer python: answerObject.getCleanOptions()"
! tal:attributes="value python:'';
! content python:'';
! selected python:'';" />
</select>
</tal:isGap>
--- 9,29 ----
<tal:repeat repeat="word python: currentQuestion.getBasetextAsList()">
! <tal:isGap tal:condition="python: word.startswith('<id=\'') and word.endswith('\'>')">
! <tal:def tal:define="answerId python:word[5:-2];
! answerObject python:currentQuestion[answerId];">
<input tal:condition="python: answerObject.portal_type=='BlindGapAnswer'"
tal:attributes="type string:text;
! name python:'##'.join([currentQuestion.UID(), answerObject.UID()]);
! value python:responseObj[answerObject.UID()];" />
<select tal:condition="python: answerObject.portal_type=='ChoiceGapAnswer'"
! tal:attributes="name python:'##'.join([currentQuestion.UID(), answerObject.UID()]);">
<option tal:repeat="answer python: answerObject.getCleanOptions()"
! tal:attributes="value answer;
! selected python:'';"
! tal:content="answer" />
</select>
+ </tal:def>
</tal:isGap>
***************
*** 49,61 ****
! <dt>user:</dt>
! <dd tal:content="python: responseObj[currentQuestion.UID()]" />
!
! <dt>example:</dt>
! <dd tal:content="python: currentQuestion.getExemplar()" />
!
! <!--span tal:condition="python:len(currentQuestion.contentValues()) > 0">
!
! </span-->
</div>
--- 50,54 ----
! no result view for FillGap, yet
</div>
Index: exam_fillgap_process.cpy
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/skins/EduploneExam/exam_fillgap_process.cpy,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** exam_fillgap_process.cpy 2 Apr 2005 13:40:38 -0000 1.1
--- exam_fillgap_process.cpy 2 Apr 2005 21:21:43 -0000 1.2
***************
*** 1,29 ****
! # Controller Python Script "exam_fillgap_process"
request = context.REQUEST
! answerId = request.get("id")
answerTitle = request.get("title")
answerCorrect = request.get("correct")
answerCaseSensitive = request.get("caseSensitive")
! answer = context[answerId]
gapWordIndex = int(request.get("gapWordIndex"))
! basetext = context.getBasetextAsList()
# Re-render basetext with newly added gap.
basetext_new = []
! for i in xrange(len(basetext)):
# Check if gap position has changed and move gap if so.
! if context.getGapPosition(answerId) != gapWordIndex and basetext[i] == "<id='%s'>" % answerId:
basetext_new.append(answer.getCorrect()[0])
else:
! if gapWordIndex == i:
basetext_new.append("<id='%s'>" % answerId)
else:
! basetext_new.append(basetext[i])
# Save settings
! context.setBasetext(" ".join(basetext_new))
answer.setTitle(answerTitle)
answer.setCorrect(answerCorrect)
! #answer.setCaseSensitive(answerCaseSensitive)
# Return to fillgap task
--- 1,50 ----
! ## Controller Python Script "exam_fillgap_process"
! ##title=Edit content
! ##bind container=container
! ##bind context=context
! ##bind namespace=
! ##bind script=script
! ##bind subpath=traverse_subpath
! ##parameters=id=''
!
request = context.REQUEST
!
answerTitle = request.get("title")
answerCorrect = request.get("correct")
answerCaseSensitive = request.get("caseSensitive")
! answer = context
gapWordIndex = int(request.get("gapWordIndex"))
!
! parent=context.aq_parent
!
! answerId = context.getId() #request.get("id")
! basetext = parent.getBasetextAsList()
! options=request.get("options")
!
# Re-render basetext with newly added gap.
basetext_new = []
! counter=0
! for i in basetext:
# Check if gap position has changed and move gap if so.
! if parent.getGapPosition(answerId) != gapWordIndex and i == "<id='%s'>" % answerId:
basetext_new.append(answer.getCorrect()[0])
else:
! if gapWordIndex == counter:
basetext_new.append("<id='%s'>" % answerId)
else:
! basetext_new.append(i)
! counter+=1
# Save settings
! parent.setBasetext(" ".join(basetext_new))
answer.setTitle(answerTitle)
answer.setCorrect(answerCorrect)
!
! if answer.meta_type=="BlindGapAnswer":
! answer.setCaseSensitive(answerCaseSensitive)
!
! if answer.meta_type=="ChoiceGapAnswer":
! answer.setOptions(options)
# Return to fillgap task
Index: exam_fillgap_edit.cpt
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/skins/EduploneExam/exam_fillgap_edit.cpt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** exam_fillgap_edit.cpt 2 Apr 2005 15:07:31 -0000 1.5
--- exam_fillgap_edit.cpt 2 Apr 2005 21:21:43 -0000 1.6
***************
*** 136,141 ****
! <form name="gapEditForm" action="exam_fillgap_process" method="POST">
<input type="hidden" name="gapWordIndex" tal:attributes="value python:here.getGapPosition(here.getId())" />
--- 136,143 ----
! <form name="gapEditForm" action="" method="POST"
! tal:attributes="action python:here.absolute_url()+'/'+template.id" >
+ <input type="hidden" name="form.submitted" value="1">
<input type="hidden" name="gapWordIndex" tal:attributes="value python:here.getGapPosition(here.getId())" />
***************
*** 146,150 ****
</metal:block>
<input class="context" type="submit"
! name="form_submit" value="Save" />
<input class="standalone" type="submit"
name="form.button.cancel" value="Cancel" />
--- 148,152 ----
</metal:block>
<input class="context" type="submit"
! name="form.button.submit" value="Save" />
<input class="standalone" type="submit"
name="form.button.cancel" value="Cancel" />
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click