EduploneExam_QOrderProcessor/skins/EduploneExam_QOrderProcessor processgroup_edit.cpt,NONE,1.1 processgroup_edit.cpt.metadata,NONE,1.1 processgroup_process.cpy,NONE,1.1 processor_view.pt,NONE,1.1

Nils Haagen <[email protected]> Wed, 28 Sep 2005 08:05:29 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam_QOrderProcessor/skins/EduploneExam_QOrderProcessor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29593

Added Files:
	processgroup_edit.cpt processgroup_edit.cpt.metadata 
	processgroup_process.cpy processor_view.pt 
Log Message:
skins... 

--- NEW FILE: processgroup_process.cpy ---
## Controller Python Script "processgroup_process"
##title=Edit content
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=id=''

request = context.REQUEST

ret={}
for q in context.aq_parent.aq_parent.objectValues('OrderQuestion'):
    ret[q.UID()]=request.get(q.UID())

    
context.set_AnswerUIDs(ret)

context.setTitle(request.get('title'))
context.setFeedback(request.get('Feedback'))


request.RESPONSE.redirect("%s/processgroup_edit?portal_status_message=%s" % (context.absolute_url(), 'your changes have been saved.'))

--- NEW FILE: processgroup_edit.cpt ---
<tal:block metal:define-macro="master"
           define="errors options/state/getErrors | nothing;
                   Iterator python:modules['Products.Archetypes'].IndexIterator;
                   schematas here/Schemata;
                   fieldsets python:[key for key in schematas.keys() if key != 'metadata'];
                   default_fieldset python:(not schematas or schematas.has_key('default')) and 'default' or fieldsets[0];
                   fieldset request/fieldset|options/fieldset|default_fieldset;
                   fields python:schematas[fieldset].editableFields(here);
                   dummy python:here.at_isEditable(fields);
                   portal_type python:here.getPortalTypeName().lower().replace(' ', '_');
                   type_name here/getPortalTypeName|here/archetype_name;
                   base_macros here/edit_macros/macros;
                   edit_template python:'%s_edit' % portal_type;
                   edit_macros python:path('here/%s/macros | nothing' % edit_template);
                   header_macro edit_macros/header | header_macro | base_macros/header;
                   typedescription_macro edit_macros/typedescription | typedescription_macro | base_macros/typedescription;
                   body_macro edit_macros/body | body_macro | base_macros/body;
                   footer_macro edit_macros/footer | footer_macro | base_macros/footer;
                   lockable python:hasattr(here, 'wl_isLocked');
                   isLocked python:lockable and here.wl_isLocked();
                   tabindex tabindex|python:Iterator(pos=7000);
                   css python:here.getUniqueWidgetAttr(fields, 'helper_css');
                   js python:here.getUniqueWidgetAttr(fields, 'helper_js');">

<html xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="en"
      lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="eduplone">

  <metal:head fill-slot="top_slot">
    <tal:block define="macro edit_macros/topslot | nothing"
               condition="macro">
	<metal:block use-macro="macro" />
    </tal:block>
  </metal:head>

  <!--metal:head fill-slot="javascript_head_slot">
    <tal:block define="macro here/archetypes_custom_js/macros/javascript_head | nothing"
               condition="macro">
      <metal:block use-macro="macro" />
    </tal:block>

    <tal:css condition="css"
             repeat="item css">
      <style type="text/css"
             media="all"
             tal:condition="python:exists('portal/%s' % item)"
             tal:content="string:@import url($portal_url/$item);">
      </style>
    </tal:css>

    <tal:js condition="js"
            repeat="item js">
      <script type="text/javascript"
              charset="iso-8859-1"
              tal:condition="python:exists('portal/%s' % item)"
              tal:attributes="src string:$portal_url/$item">
      </script>
    </tal:js>
  </metal:head-->

  <body>

    <metal:fill fill-slot="main">
      <metal:main define-macro="main">
        <metal:use_header use-macro="header_macro" />
        <metal:use_typedescription use-macro="typedescription_macro" />

        

        
        <form name="editForm" action="" method="POST"
              tal:attributes="action python:here.absolute_url()+'/'+template.id" >
        
                  <input type="hidden" name="form.submitted" value="1" />
                
        
                  <metal:block define-slot="widgets">
                    <tal:fields repeat="field fields">
                      <metal:fieldMacro use-macro="python:here.widget(field.getName(), mode='edit')" />
                    </tal:fields>
                  </metal:block>


                <dl tal:define="qa_dict      python: here.get_Exam_OrderAnswers();">
            
                <div:rep tal:repeat="qa qa_dict " 
                         tal:omit-tag=" ">
                    <dt tal:content="python: qa_dict[qa][0]" />
                    <dd>
                        <div tal:repeat="answer python: qa_dict[qa][2]" 
                                 tal:omit-tag=" ">
                            
                             <input type="radio" 
                                    tal:attributes="name     python: qa_dict[qa][1];
                                                    value    python: answer.UID();
                                                    checked  python: test(here.getAnswerUIDforQuestion(qa_dict[qa][1])==answer.UID(), 'checked', None);" />

                             <span tal:content="python: answer.Title()" />

                             <br />
                        </div>
                    </dd>

                </div:rep>
                </dl>


                  <input class="context" type="submit"
                         name="form.button.submit" value="Save" i18n:attributes="value" />
                  <input class="standalone" type="submit"
                         name="form.button.cancel" value="Cancel" i18n:attributes="value" />
        </form>

        <metal:use_footer use-macro="footer_macro" />
      </metal:main>
    </metal:fill>

  </body>

</html>

</tal:block>

--- NEW FILE: processgroup_edit.cpt.metadata ---
[validators]

[actions]
action.success..submit = traverse_to:string:processgroup_process

--- NEW FILE: processor_view.pt ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
      lang="en-US"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="eduplone">
  <body>

    <link metal:fill-slot="css_slot"
          rel="stylesheet" 
          type="text/css"
          media="all"
          tal:attributes="href python:here.absolute_url()+'/exam_additionalstyles.css'" />

    <div metal:fill-slot="main">


        <div metal:define-macro="main"
             tal:omit-tag="">

            
            <table border=1
                   tal:define="examOrderQuestions  python:here.aq_parent.objectValues('OrderQuestion');
                               procAnswers         python:here.get_Proc_OrderAnswers()" >

                <tr><td></td>
                    <td tal:repeat="pA procAnswers"><b tal:content="python: procAnswers[pA][0]" /></td>
                </tr>

                <tr tal:repeat="question examOrderQuestions">
                    <td tal:content="question/question" />
                   
                    <td tal:repeat="processGroup python:here.objectValues()" 
                        tal:content="python: context.deliverResponse(question, create=False).getResponseValues()[processGroup.getAnswerUIDforQuestion(question.UID())]" />
                </tr>

                <tr><td></td>
                    <td tal:repeat="processGroup python:here.objectValues()"> 
                        <b tal:content="python: processGroup.sumUp()" />
                    </td>
                </tr>
            </table>
            
            
            <div tal:define="feedback here/maxSumFeedback">
            
                <h1 tal:content="python: feedback[0]" />
                <span tal:content="python: feedback[1]" />

            </div>
        
        </div>

    </div>

  </body>
</html>



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl