Changeset 3072 for trunk


Ignore:
Timestamp:
10/31/10 03:55:39 (9 years ago)
Author:
jukka
Message:

Working with exercise editing

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/FieldsWidgets.py

    r3069 r3072  
    460460                            changes['new_chapters']=new_chapters 
    461461                            form.update({'chapter_edited':count, 'chapter_anchor':count, 'stay':1}) 
     462        print changes 
    462463        return changes, {} 
    463464    
     
    753754     
    754755    security = ClassSecurityInfo() 
     756    chapter_names={'text_block':_('text chapter'), 'media_piece':_('media piece'), 'embed_block':_('embedded content'), 'multiple_choices':_('multiple choices'), 'choices':_('choices'), 'fill_in_the_blanks':_('fill in the blanks'), 'open_ended':_('open ended question')} 
     757 
     758    def getChapterNames(self): 
     759        """ Return readable versions of different chapter types """         
     760        return ChapterField.chapter_names  
     761 
    755762 
    756763    def getRaw(self, instance, version=None, **kwargs): 
    757764        """ Gets raw version for editing, as list """ 
    758         print 'ChapterField.getRaw called with args ', kwargs 
    759765        if version: 
    760766            value = instance.getFieldHistory(self.getName(), version) or [] 
    761767        elif '_initializing_' in kwargs: 
    762             print '**** initializing, no need to SET'  
    763768            value = self.getDefault(instance) or []     
    764769        else: 
     
    766771        if not isinstance(value, list): 
    767772            value = [] 
     773        for chapter in value: 
     774            if isinstance(chapter, tuple): 
     775                value = self.updateChapterList(value) 
     776                break 
    768777        return value 
    769778 
     
    778787            version=None 
    779788            translation=None 
     789        convert=False 
     790 
    780791        if version or translation: # don't cache cleaned version 
    781792            value = self.getRaw(instance, version=version, **kwargs) 
    782             if isinstance(value[0], tuple): # update chapters if necessary 
     793            if convert: 
    783794                value = self.updateChapterList(value) 
    784795            value=self.cleanChapters(instance, value) 
     
    788799        cleaned_value = getattr(instance, 'cleaned_%s' % self.getName(), None)  
    789800        if cleaned_value: 
    790             if isinstance(cleaned_value[0], dict): 
    791                 print 'no need to convert, giving cleaned as it is' 
    792                 return cleaned_value 
    793             else: # Retroactively fix cleaned chapters 
     801            for chapter in cleaned_value: 
     802                if isinstance(chapter, tuple): 
     803                    convert=True 
     804                    break 
     805            if convert: 
    794806                cleaned_value=self.updateChapterList(cleaned_value) 
    795807                cleaned_value=self.updateCleanedChapters(instance, cleaned_value) 
    796808                print 'converted and updated cleaned chapter list' 
    797                 print cleaned_value 
    798                 #print cleaned_value 
     809                return cleaned_value 
     810            else: 
     811                print 'no need to convert, giving cleaned as it is' 
    799812                return cleaned_value 
    800813        print 'ChapterField is calling getRaw...' 
    801814        value=self.getRaw(instance, **kwargs) 
    802815        print '...ChapterField has called getRaw.' 
    803         if value and isinstance(value[0], tuple):  
    804             print 'raw needs to be converted...' 
    805             value = self.updateChapterList(value) 
    806816        cleaned_value=self.updateCleanedChapters(instance, value) 
    807817        print 'updated cleaned chapter'  
    808         #print cleaned_value 
    809818        return cleaned_value 
    810819 
     
    839848        setattr(instance, 'cleaned_%s' % self.getName(), cleaned_chapters) 
    840849        return cleaned_chapters 
    841  
    842     def confirmUpdated(self, chapters): 
    843         """ Edit macros use raw data, which may be in old tuple-format. Update if necessary. """         
    844         print 'confirmUpdated called with ', chapters  
    845         if chapters and type(chapters[0])==tuple: 
    846             chapters= self.updateChapterList(chapters) 
    847         return chapters 
    848  
    849850         
    850851 
     
    897898            elif ctype=='embed_block': 
    898899                new_chapter={'text':'', 'type':'embed_block', 'embed':cvalue} 
     900            elif ctype=='guidelines': 
     901                new_chapter={'text':cvalue, 'type':'text_block'} 
    899902            else: 
    900903                new_chapter={'text':cvalue, 'type':ctype} 
     
    934937                # build _one_ chapter based on input 
    935938                new_chapter={'type':ctype} 
    936                 if ctype in ['multiple_choice','choices','poll']: 
     939                if ctype in ['multiple_choices','choices','poll']: 
    937940                    new_chapter['text']=value['question'] 
    938941                    choices=[] 
  • trunk/LargeSectionFolder.py

    r3067 r3072  
    259259        else: 
    260260            return self 
    261  
    262  
    263     def getMetadataFieldsToShowInEditor(self, object): 
    264         """ gets fields which are shown in metadata edit area """ 
    265         type = object.meta_type 
    266         shownFieldsList = SHOW_METADATA_FIELDS[type] 
    267         shownFields = [] 
    268         fields = object.Schemata()['metadata'].fields() 
    269         # At this point, the method can return a list of all metadata 
    270         if 'all' in shownFieldsList: 
    271             return fields 
    272         else: 
    273             for field in fields: 
    274                 if field.getName() in shownFieldsList: 
    275                     shownFields.append(field) 
    276             return shownFields 
    277261 
    278262    def amIManager(self): 
  • trunk/LatexTool.py

    r2904 r3072  
    8585gspath     = findinpath('gs') 
    8686dvipspath  = findinpath('dvips') or '/usr/texbin/dvips' 
    87 latexpath  = findinpath('latex') 
     87latexpath  = findinpath('latex') or '/usr/texbin/latex' 
    8888print dvipngpath 
    8989print gspath 
     
    153153        if LATEX_IMAGES_STORAGE_PATH: 
    154154            try: 
    155                 #print latexCode 
     155            #print latexCode 
    156156                return self.getLocalImageFor(latexCode, charheightpx) 
    157157            except (IOError, LatexSyntaxError), data: 
     158            #    print data 
    158159                errors = str(data) 
    159160                self.log(errors, 'LatexSyntaxError') 
    160161        if EXTERNAL_LATEX_SERVICE: 
    161             return self.getRemoteImageFor(latexCode) 
     162            return self.getRemoteImageFor(latexCode)             
    162163        else: 
    163164            return latexCode             
     
    245246        images that don't already exist. 
    246247        """ 
     248        print 'LATEX: rendering images' 
    247249        latexTemplate = (kw.get('latexTemplate', defaultLatexTemplate) or 
    248250                         defaultLatexTemplate) 
     
    264266        unifiedCode=codeToRender[0] 
    265267        try: 
    266            self.runLatex(unifiedCode, res, charheightpx, latexTemplate) 
     268            self.runLatex(unifiedCode, res, charheightpx, latexTemplate) 
    267269        except LatexSyntaxError, data: 
    268270           errors = str(data) 
     
    280282            if False and re.match(r'^(?:\$|\\\()', code): # FIXME make dvipng do the alpha properly 
    281283                im = Image.open(os.path.join(workingDir, imname)) 
    282                 print 'aligning %s (%s)' % (imname, im.mode) 
    283284                try: 
    284285                    im = self.align(im, charheightpx, alignfudge) # returns an RGBA image 
     
    310311        file.write(latexTemplate %(code,)) 
    311312        file.close() 
    312      
    313313        err, stdout, stderr = self.runCommand(cmdLine) 
    314314         
    315315        if err: 
    316             out = stderr + '\n' + stdout 
     316            out = stderr + '\n' + stdout+'\n'+ cmdLine 
    317317            err = re.search('!.*\?', out, re.MULTILINE+re.DOTALL) 
    318318            if err: 
  • trunk/config.py

    r3067 r3072  
    9090# /zope-instance/var/latex_images 
    9191LATEX_IMAGES_STORAGE_PATH='latex_images' # this will be a directory under your zope instances var/  
    92 EXTERNAL_LATEX_SERVICE='http://www.forkosh.dreamhost.com/mimetex.cgi?' 
     92 
     93# Forkosh service seems to be closed for us now. 
     94#EXTERNAL_LATEX_SERVICE='http://www.forkosh.dreamhost.com/mimetex.cgi?' 
     95EXTERNAL_LATEX_SERVICE='' 
    9396 
    9497# To disable local latex, uncomment line below: 
  • trunk/skins/lemill/base_metadata.cpt

    r2929 r3072  
    2525      <div metal:define-macro="main"> 
    2626 
    27     <h1 i18n:translate="heading_about_page_for">About: 
    28             <span i18n:name="title" tal:content="context/title_or_id"/> 
    29     </h1> 
     27    <h1 i18n:translate="heading_about_page_for">About:<span i18n:name="title"></span></h1> 
    3028 
    3129 
     
    3634        tal:attributes="action string:${here_url}/${template/id}"> 
    3735 
    38         <tal:fields repeat="field python: here.getMetadataFieldsToShowInEditor(here)"> 
     36        <metal:fieldMacro use-macro="python: here.widget('title', mode='edit')"/> 
     37        <tal:fields repeat="field python: here.Schemata()['metadata'].fields()"> 
    3938        <metal:fieldMacro use-macro="python: here.widget(field.getName(), mode='edit')"/> 
    4039        </tal:fields> 
    41  
    4240        <tal:block metal:use-macro="here/multimediamaterial_edit/macros/minor_edit"/> 
    43  
    44       <input type="hidden" name="form.submitted" value="1" /> 
     41        <metal:buttons use-macro="here/button_macros/macros/save_buttons" />                                         
    4542 
    4643      <input type="hidden" name="fieldset" value="metadata" 
    4744       tal:attributes="value fieldset|string:metadata" /> 
    48  
    4945      <input type="hidden" name="current_lang" value="" 
    5046       tal:attributes="value request/LANGUAGE|default_language|default" /> 
    51         
    52       <div class="field"> 
    53         <label>&nbsp;</label> 
    54         <input class="context" 
    55          tabindex="" 
    56          type="submit" 
    57          name="form.button.form_submit" i18n:domain="plone" 
    58          i18n:attributes="value label_save;" 
    59          value="Save" 
    60          tal:attributes="tabindex tabindex/next;" /> 
    61       </div> 
    6247  </form> 
    6348      </div> 
  • trunk/skins/lemill/content_edit.cpy.metadata

    r3045 r3072  
    77[actions] 
    88action.success = redirect_to_action:string:view 
    9 action.success..save_and_move = traverse_to:string:metadata 
     9action.success..save_and_move = traverse_to:string:base_metadata 
    1010action.failure = traverse_to_action:string:edit 
  • trunk/skins/lemill/exercisematerial_edit.cpt

    r2953 r3072  
    77    metal:use-macro="here/form_template/macros/master" 
    88    i18n:domain="lemill"> 
    9  
    109    <body> 
    1110        <metal:main fill-slot="main"> 
    1211            <metal:macro define-macro="body"> 
    13             <form action="" method="post"  
    14                 tal:attributes="action string:${here_url}/${template/id}" 
    15                 enctype="multipart/form-data" 
    16                 class="enableUnloadProtection" 
    17                 tal:condition="here/canIEdit"> 
    18  
    19                 <div style="display:none"> 
    20                 <xml id="dataisland" style="display:none"> 
    21                 <configset> 
    22                 <config id="search-result-box">piece-search-results</config> 
    23                 <config id="search-string-base">piece-search-</config> 
    24                 <config id="target-div-id">piece-edit-box-</config> 
    25                 <config id="piece-referencing-input">bodyText_</config> 
    26                 <config id="selected-media-box">insertHere</config> 
    27                 <config id="image-size">large</config> 
    28                 </configset> 
    29                 </xml> 
    30                 </div> 
    31  
     12            <form action="" method="post" tal:attributes="action string:${here_url}/${template/id}" enctype="multipart/form-data" class="enableUnloadProtection" tal:condition="here/canIEdit"> 
    3213                <tal:block tal:define="visibleFields python:context.getTemplate('exercisepage').get('fields')"> 
    3314                    <tal:fields repeat="field fields"> 
     
    3617                        </tal:cond> 
    3718                    </tal:fields> 
    38  
    3919                </tal:block> 
    40  
    4120                <tal:block metal:use-macro="here/multimediamaterial_edit/macros/minor_edit"/> 
    42  
    43         <div style="margin-top:20px"> 
    44             <tal:comment replace="nothing">XXX:Where is the origin of these buttons. don't special ones here anymore.</tal:comment> 
    45         <tal:if_translation condition="translation"> 
    46         <input type="hidden" 
    47             name="translation" 
    48             value="1" 
    49             /> 
    50         <input type="hidden" 
    51             name="translation_of" 
    52             tal:attributes="value source/UID" 
    53             /> 
    54         </tal:if_translation> 
    55  
    56         <metal:eula_here use-macro="here/multimediamaterial_edit/macros/eula" /> 
    57  
    58         <input class="context" 
    59             tabindex="" 
    60             type="submit" 
    61             name="form.button.exercise_form_submit" 
    62             value="Save" i18n:domain="plone" 
    63             i18n:attributes="value label_save;" 
    64             tal:attributes="tabindex tabindex/next; 
    65             disabled python:test(isLocked, 'disabled', None);" 
    66             /> 
    67         <input class="standalone" 
    68             tabindex="" 
    69             type="submit" 
    70             name="form.button.cancel" 
    71             value="Cancel" i18n:domain="plone"  
    72             i18n:attributes="value label_cancel;" 
    73             tal:attributes="tabindex tabindex/next" 
    74             /> 
    75         </div> 
    76         <input type="hidden" name="form.submitted" value="1" /> 
    77  
    78         </form> 
    79             </metal:macro> 
    80         </metal:main> 
    81  
     21                <metal:buttons use-macro="here/button_macros/macros/save_buttons" />                                         
     22            </form> 
     23        </metal:macro> 
     24      </metal:main> 
    8225    </body> 
    8326</html> 
  • trunk/skins/lemill/field.pt

    r3069 r3072  
    5454          <div class="translatedText"  
    5555              tal:condition="python: translation and not copied_in_translation"> 
    56               <label class="field_title" i18n:translate="original_label"> 
     56              <label class="field_label" i18n:translate="original_label"> 
    5757              Original  
    5858                     <span i18n:name="field_label" tal:replace="python:widget.Label(here).lower()" /> 
     
    6262              </div> 
    6363          </div> 
    64           <label class="field_title" i18n:translate="" tal:content="python:widget.Label(here)" tal:attributes="for python:field.getName()">Label</label> 
     64          <label class="field_label" i18n:translate="" tal:content="python:widget.Label(here)" tal:attributes="for python:field.getName()">Label</label> 
    6565          <span class="fieldRequired" 
    6666                tal:condition="field/required" 
  • trunk/skins/lemill/lemill_content_add.cpt

    r3069 r3072  
    66<body> 
    77 
    8     <div metal:fill-slot="main" style="width:100%"> 
    9         <div id="selection"> 
    10          
    11         <h1 i18n:translate="heading_new_content">New content</h1> 
    12          
    13         <p i18n:translate="text_sending_content_types">Choose the type of content you want to add.</p> 
     8<div metal:fill-slot="main" style="width:100%"> 
     9    <div id="selection"> 
     10     
     11    <h1 i18n:translate="heading_new_content">New content</h1> 
     12     
     13    <ul class="result_list"> 
     14        <li> 
     15            <div class="list_cover_box">&nbsp;<a href="createObject?type_name=MultimediaMaterial"> 
     16                <img src="images/default_multimedia_page.png" width="120" height="120" border="0" /> 
     17            </a>&nbsp;</div> 
     18            <div class="list_data_box"> 
     19                <p><strong><a i18n:translate="" href="createObject?type_name=MultimediaMaterial">Web page</a></strong><br>                
     20                    <tal:block i18n:translate="" >Create a web page with images, sound and movie clips</tal:block> 
     21                </p> 
     22            </div> 
     23        </li> 
     24        <li> 
     25            <div class="list_cover_box">&nbsp;<a href="createObject?type_name=ExerciseMaterial"> 
     26                <img src="images/default_exercise.png" width="120" height="120" border="0" /> 
     27            </a>&nbsp;</div> 
     28            <div class="list_data_box"> 
     29                <p><strong><a i18n:translate="" href="createObject?type_name=ExerciseMaterial">Exercise</a></strong><br>                
     30                    <tal:block i18n:translate="" >Create a web page with exercises.</tal:block> 
     31                </p> 
     32            </div> 
     33        </li> 
     34        <li> 
     35            <div class="list_cover_box">&nbsp;<a href="createObject?type_name=LessonPlan"> 
     36                <img src="images/default_lesson_plan.png" width="120" height="120" border="0" /> 
     37            </a>&nbsp;</div> 
     38            <div class="list_data_box"> 
     39                <p><strong><a i18n:translate="" href="createObject?type_name=LessonPlan">Lesson plan</a></strong><br>                
     40                    <tal:block i18n:translate="" >Create a web page with lesson plan.</tal:block> 
     41                </p> 
     42            </div> 
     43        </li> 
     44        <li> 
     45            <div class="list_cover_box">&nbsp;<a href="createObject?type_name=PILOTMaterial"> 
     46                <img src="images/default_pilot.png" width="120" height="120" border="0" /> 
     47            </a>&nbsp;</div> 
     48            <div class="list_data_box"> 
     49                <p><strong><a i18n:translate="" href="createObject?type_name=PILOTMaterial">PILOT</a></strong><br>                
     50                    <tal:block i18n:translate="" >Create a Flash movie for initiating progressive inquiry.</tal:block> 
     51                </p> 
     52            </div> 
     53        </li> 
     54        <li> 
     55            <div class="list_cover_box">&nbsp;<a href="javascript:$('#selection').hide();$('#upload').show();void(0);"> 
     56                <img src="images/default_media_piece.png" width="120" height="120" border="0" /> 
     57            </a>&nbsp;</div> 
     58            <div class="list_data_box"> 
     59                <p><strong><a i18n:translate="" href="javascript:$('#selection').hide();$('#upload').show();void(0);">Media piece</a></strong><br>                
     60                    <tal:block i18n:translate="description_add_media_piece" >Upload images and sound clips that can be used to create learning resources.</tal:block> 
     61                </p> 
     62            </div> 
     63        </li> 
     64        <li> 
     65            <div class="list_cover_box">&nbsp;<a href="createObject?type_name=LeMillReference"> 
     66                <img src="images/default_reference.png" width="120" height="120" border="0" /> 
     67            </a>&nbsp;</div> 
     68            <div class="list_data_box"> 
     69                <p><strong><a i18n:translate="" href="javascript:$('#selection').hide();$('#upload').show();void(0);">Reference</a></strong><br>                
     70                    <tal:block i18n:translate="description_add_reference" >Add a link to an external website or other learning resource.</tal:block> 
     71                </p> 
     72            </div> 
     73        </li> 
     74    </ul> 
     75    <div class="clear"></div> 
    1476 
    15         <ul id="template_list" class="expanded"> 
    16             <li class="resultobject"> 
    17                     <div class="templateicon"> 
    18                         <a href="createObject?type_name=MultimediaMaterial"> 
    19                             <img src="images/default_multimedia_page.png" width="120" height="120" border="0" /> 
    20                         </a> 
    21                     </div> 
    22                 <div class="templatedescription"> 
    23                     <dl> 
    24                     <dt class="browse_title_r"> 
    25                         <strong><a i18n:translate="" href="createObject?type_name=MultimediaMaterial">Web page</a></strong> 
    26                     </dt>                 
    27                     <dd class="browse_info" i18n:translate="" >Create a web page with images, sound and movie clips</dd> 
    28                 </dl> 
    29                 </div> 
    30             </li> 
    31             <li class="resultobject"> 
    32                     <div class="templateicon"> 
    33                         <a href="createObject?type_name=ExerciseMaterial"> 
    34                             <img src="images/default_exercise.png" width="120" height="120" border="0" /> 
    35                         </a> 
    36                     </div> 
    37                 <div class="templatedescription"> 
    38                     <dl> 
    39                     <dt class="browse_title_r"> 
    40                         <strong><a i18n:translate="" href="createObject?type_name=ExerciseMaterial" >Exercise</a></strong> 
    41                     </dt>                 
    42                     <dd class="browse_info" i18n:translate="" >Create a web page with exercises.</dd> 
    43                 </dl> 
    44                 </div> 
    45             </li> 
    46             <li class="resultobject"> 
    47                     <div class="templateicon"> 
    48                         <a href="createObject?type_name=LessonPlan"> 
    49                             <img src="images/default_lesson_plan.png" width="120" height="120" border="0" /> 
    50                         </a> 
    51                     </div> 
    52                 <div class="templatedescription"> 
    53                     <dl> 
    54                     <dt class="browse_title_r"> 
    55                         <strong><a i18n:translate="" href="createObject?type_name=LessonPlan" >Lesson plan</a></strong> 
    56                     </dt>                 
    57                     <dd class="browse_info" i18n:translate="" >Create a web page with lesson plan.</dd> 
    58                 </dl> 
    59                 </div> 
    60             </li> 
    61             <li class="resultobject"> 
    62                     <div class="templateicon"> 
    63                         <a href="createObject?type_name=PILOTMaterial"> 
    64                             <img src="images/default_pilot.png" width="120" height="120" border="0" /> 
    65                         </a> 
    66                     </div> 
    67                 <div class="templatedescription"> 
    68                     <dl> 
    69                     <dt class="browse_title_r"> 
    70                         <strong><a i18n:translate="" href="createObject?type_name=PILOTMaterial" >PILOT</a></strong> 
    71                     </dt>                 
    72                     <dd class="browse_info" i18n:translate="" >Create a Flash movie for initiating progressive inquiry.</dd> 
    73                 </dl> 
    74                 </div> 
    75             </li> 
    76             <li class="resultobject"> 
    77                     <div class="templateicon"> 
    78                         <a href="javascript:$('#selection').hide();$('#upload').show();void(0);"> 
    79                             <img src="images/default_media_piece.png" width="120" height="120" border="0" /> 
    80                         </a> 
    81                     </div> 
    82                 <div class="templatedescription"> 
    83                     <dl> 
    84                     <dt class="browse_title_r"> 
    85                         <strong><a i18n:translate="" href="javascript:$('#selection').hide();$('#upload').show();void(0);" >Media piece</a></strong> 
    86                     </dt>                 
    87                     <dd class="browse_info" i18n:translate="description_add_media_piece" >Upload images and sound clips that can be used to create learning resources.</dd> 
    88                 </dl> 
    89                 </div> 
    90             </li> 
    91             <li class="resultobject"> 
    92                     <div class="templateicon"> 
    93                         <a href="createObject?type_name=LeMillReference"> 
    94                             <img src="images/default_reference.png" width="120" height="120" border="0" /> 
    95                         </a> 
    96                     </div> 
    97                 <div class="templatedescription"> 
    98                     <dl> 
    99                     <dt class="browse_title_r"> 
    100                         <strong><a i18n:translate="" href="createObject?type_name=LeMillReference" >Reference</a></strong> 
    101                     </dt>                 
    102                     <dd class="browse_info" i18n:translate="description_add_reference" >Add a link to an external website or other learning resource.</dd> 
    103                 </dl> 
    104                 </div> 
    105             </li> 
    106  
    107         </ul> 
    108  
    109         <p metal:define-macro="feeling_lost" i18n:translate="text_feeling_lost">If you are not sure which option to choose you can have a look at the <span i18n:name="FAQ"><a tal:attributes="href string:${portal_url}/content/webpages/lemill-faq" i18n:translate="text_feeling_lost_faq" href="lemill-faq">FAQ</a></span> or you may <span i18n:name="go_back"><a i18n:translate="text_feeling_lost_go_back" href="javascript:history.go(-1)">go back</a></span> to the previous page.</p> 
     77    <p metal:define-macro="feeling_lost" i18n:translate="text_feeling_lost">If you are not sure which option to choose you can have a look at the <span i18n:name="FAQ"><a tal:attributes="href string:${portal_url}/content/webpages/lemill-faq" i18n:translate="text_feeling_lost_faq" href="lemill-faq">FAQ</a></span> or you may <span i18n:name="go_back"><a i18n:translate="text_feeling_lost_go_back" href="javascript:history.go(-1)">go back</a></span> to the previous page.</p> 
    11078 
    11179</div> 
     
    12795                <div class="form_submit"> 
    12896                <input class="save" 
     97                    style="width:200px;" 
    12998                    tabindex="" 
    13099                    type="submit" 
  • trunk/skins/lemill/lemill_grid.css

    r3070 r3072  
    624624    } 
    625625 
    626 label.field_label { 
     626/*label.field_label { 
    627627    font-weight:bold !important; 
    628628    } 
     629*/ 
    629630 
    630631.portalMessage, 
     
    678679} 
    679680 
     681fieldset { 
     682    border: 1px solid #8cacbb; 
     683} 
     684 
    680685fieldset.edit_box { 
    681     border: 1px solid #8cacbb; 
    682686    padding: 0; 
    683687    margin-top: 0.25em; 
     
    700704.undeleteButton { 
    701705    text-decoration:none !important; 
     706} 
     707 
     708div.pilot_flash_area { 
     709    border: 4px solid #dddddd; 
     710    width: 500px; 
    702711} 
    703712 
     
    792801*/ 
    793802 
     803/* Exercise wizard */ 
     804div.inner_edit { 
     805    display:none; 
     806    position:absolute; 
     807    height:290px; 
     808    width:700px; 
     809} 
    794810 
    795811/* Full screen view */ 
  • trunk/skins/lemill/master.js

    r3070 r3072  
    168168    $('input#chapter_type').val(qtype); 
    169169    $('#question_selection').hide('slide', {direction:'left'}); 
    170     $('#multiple_choice_edit').show('slide', {direction:'right'}); 
     170    $('#'+qtype+'_edit').show('slide', {direction:'right'}); 
    171171} 
    172172 
  • trunk/skins/lemill/piece_edit.cpt

    r3028 r3072  
    5555        </tal:ifaudio> 
    5656 
    57         <tal:titlefield> 
    58             <metal:fieldMacro use-macro="python: here.widget('title', mode='edit')"/> 
    59         </tal:titlefield> 
    60  
    61         <tal:fields repeat="field python: here.getMetadataFieldsToShowInEditor(here)"> 
    62             <metal:fieldMacro use-macro="python: here.widget(field.getName(), mode='edit')"/> 
    63         </tal:fields> 
    64  
    65             <p i18n:translate="text_original_author_of_piece">If you are not the author of this piece you must add <span i18n:name="copyright_info"><a href="javascript:$('#copyright').toggle('slow');void(0);" i18n:translate="text_snippet_copyright_information">copyright information</a></span></p> 
     57        <metal:fieldMacro use-macro="python: here.widget('title', mode='edit')"/> 
     58        <metal:fieldMacro use-macro="python: here.widget('description', mode='edit')"/> 
     59        <metal:fieldMacro use-macro="python: here.widget('tags', mode='edit')"/> 
     60        <p i18n:translate="text_original_author_of_piece">If you are not the author of this piece you must add <span i18n:name="copyright_info"><a href="javascript:$('#copyright').toggle('slow');void(0);" i18n:translate="text_snippet_copyright_information">copyright information</a></span></p> 
    6661        <div id="copyright" style="display:none"> 
    6762            <metal:fieldMacro use-macro="python: here.widget('originalAuthor', mode='edit')"/> 
    6863            <metal:fieldMacro use-macro="python: here.widget('rights', mode='edit')"/> 
    69  
    7064        </div> 
    71  
    72  
    73       <input type="hidden" name="form.submitted" value="1" /> 
    74  
    75         <tal:comment replace="nothing"> 
    76         This comes from edit_macros, which is somehow used by base_edit.  it seems 
    77         base_metadata and base_edit are NOT generated the same way ;-( 
    78         </tal:comment> 
    79             <input type="hidden" 
    80                    name="add_reference.field:record" 
    81                    value="" 
    82                    /> 
    83             <input type="hidden" 
    84                    name="add_reference.type:record" 
    85                    value="" 
    86                    /> 
    87             <input type="hidden" 
    88                    name="add_reference.destination:record" 
    89                    value="" 
    90                    /> 
    91         
    92       <div class="field"> 
    93         <label>&nbsp;</label> 
    94         <input class="context" 
    95          tabindex="" 
    96          type="submit" 
    97          name="Change" i18n:domain="plone" 
    98          i18n:attributes="value label_save;" 
    99          value="Save" 
    100          tal:attributes="tabindex tabindex/next;" /> 
    101  
    102         <input class="standalone" 
    103             tabindex="" 
    104             type="submit" 
    105             name="form.button.cancel" 
    106             value="Cancel" i18n:domain="plone" 
    107             i18n:attributes="value label_cancel;" 
    108             tal:attributes="tabindex tabindex/next" 
    109             /> 
    110  
    111       </div> 
     65        <metal:buttons use-macro="here/button_macros/macros/save_buttons" />                                         
    11266  </form> 
    11367      </div> 
  • trunk/skins/lemill/widget_chapter.pt

    r3070 r3072  
    4949 <metal:use use-macro="field_macro | here/field/macros/edit"> 
    5050  <metal:fill fill-slot="widget_body"> 
     51   <metal:chapter_editor_block define-macro="chapter_editor"> 
    5152  <tal:define define="edit_chapter request/chapter_edited | python:0; 
    5253              edit_chapter python: int(edit_chapter); 
    5354              translation translation | python:0; 
    54               value python:field.confirmUpdated(value); 
    5555              chapter_count python:len(value); 
    5656              edit_chapter python: test(edit_chapter&lt;chapter_count, edit_chapter, chapter_count-1);             
    5757              cleaned_chapters here/getBodyText; 
    5858              macro_mapping python:{'text_block':'here/widget_chapter/macros/%s_text_block', 
     59                'guidelines':'here/widget_exercise/macros/%s_guidelines', 
    5960                'media_piece':'here/widget_chapter/macros/%s_media_piece', 
    60                 'embed_block':'here/widget_chapter/macros/%s_embed_block'}; 
    61               chapter_names python:{'text_block':'text chapter', 'media_piece':'media piece', 'embed_block':'embedded content'};"> 
     61                'embed_block':'here/widget_chapter/macros/%s_embed_block', 
     62                'choice':'here/widget_exercise/macros/%s_choice', 
     63                'multiple_choices':'here/widget_exercise/macros/%s_multiple_choices', 
     64                'poll':'here/widget_exercise/macros/%s_poll', 
     65                'fill_in_the_blanks':'here/widget_exercise/macros/%s_fill_in_the_blanks', 
     66                'open_ended':'here/widget_exercise/macros/%s_open_ended', 
     67                'exercise':'here/widget_exercise/macros/%s_exercise'}; 
     68              chapter_names field/getChapterNames;"> 
    6269    <input type="hidden" name="chapter_count" id="chapter_count" value="1" tal:attributes="value chapter_count"/> 
    6370    <input type="hidden" name="chapter_edited" id="chapter_edited" value="0" tal:attributes="value edit_chapter"/> 
     
    134141   </tal:chapters> 
    135142   </div> 
    136    <tal:buttons condition="not:translation"> 
     143   </tal:define> 
     144   </metal:chapter_editor_block> 
     145   <tal:buttons> 
    137146       <input class="context" 
    138147           tabindex="" 
     
    160169           /> 
    161170   </tal:buttons> 
    162   </tal:define> 
    163171 </metal:fill> 
    164172</metal:use> 
  • trunk/skins/lemill/widget_exercise.pt

    r3069 r3072  
    3636            <label for="your_name"><tal:block i18n:translate="label_your_name">Your name</tal:block></label> 
    3737            <div class="formHelp" i18n:translate="desc_exercise_your_name">If you're sending exercise to teacher, enter your name so that the teacher knows who completed the exercise.</div>         
    38             <p> 
    39             <input type="text" value="" id="your_name" name="your_name" tal:attributes="tabindex tabindex/next"/> 
    40             </p> 
     38            <p><input type="text" value="" id="your_name" name="your_name" tal:attributes="tabindex tabindex/next"/></p> 
    4139 
    4240        <div class="visualClear" style="height:10px">&nbsp;</div> 
    4341            <label for="students_email"><tal:block i18n:translate="label_your_email">Your e-mail</tal:block> 
    44                 <span class="fieldRequired" title="Required" 
    45                 i18n:attributes="title title_required;" 
    46                 i18n:translate="label_required">(Required)</span> 
     42                <span class="fieldRequired" title="Required" i18n:attributes="title title_required;" i18n:translate="label_required">(Required)</span> 
    4743            </label> 
    4844            <div class="formHelp" i18n:translate="desc_exercise_your_email">Enter your e-mail to get automatic feedback to your answers.</div>         
    49             <p> 
    50             <input type="text" value="" id="students_email" name="students_email" tal:attributes="tabindex tabindex/next"/> 
    51             </p> 
    52         <div class="visualClear" style="height:10px">&nbsp;</div> 
    53  
     45            <p><input type="text" value="" id="students_email" name="students_email" tal:attributes="tabindex tabindex/next"/></p> 
     46        <div class="visualClear" style="height:10px">&nbsp;</div> 
    5447            <label for="teachers_email"><tal:block i18n:translate="label_teachers_email">Teacher's e-mail</tal:block></label> 
    5548            <div class="formHelp" i18n:translate="desc_exercise_teachers_email">Enter your teacher's e-mail to send your answers for assessment.</div>         
    56             <p> 
    57             <input type="text" value="" id="teachers_email" name="teachers_email" tal:attributes="tabindex tabindex/next"/> 
    58             </p> 
    59         <div class="visualClear" style="height:10px">&nbsp;</div> 
    60  
    61             <label for="captcha"><tal:block i18n:translate="label_humanity_test">Humanity test</tal:block></label> 
    62             <div class="formHelp" i18n:domain="lemill" i18n:translate="help_humanity_captcha_test"> 
    63                 Please type the word you see in the image into this field. This is important to make sure that you are a human and not a robot that will spam LeMill. 
    64             </div> 
    65     <tal:block tal:content="structure context/lemill_tool/generateCaptcha" /> 
    66         <div class="visualClear" style="height:10px">&nbsp;</div> 
    67             <p> 
    68             <input class="context" tabindex="" type="submit" name="submit" value="Submit" i18n:attributes="value button_send_submit;" tal:attributes="tabindex tabindex/next"/> 
    69             </p> 
     49            <p><input type="text" value="" id="teachers_email" name="teachers_email" tal:attributes="tabindex tabindex/next"/></p> 
     50        <div class="visualClear" style="height:10px">&nbsp;</div> 
     51        <label for="captcha"><tal:block i18n:translate="label_humanity_test">Humanity test</tal:block></label> 
     52        <div class="formHelp" i18n:domain="lemill" i18n:translate="help_humanity_captcha_test">Please type the word you see in the image into this field. This is important to make sure that you are a human and not a robot that will spam LeMill.</div> 
     53        <tal:block tal:content="structure context/lemill_tool/generateCaptcha" /> 
     54        <div class="visualClear" style="height:10px">&nbsp;</div> 
     55            <p><input class="context" tabindex="" type="submit" name="submit" value="Submit" i18n:attributes="value button_send_submit;" tal:attributes="tabindex tabindex/next"/></p> 
    7056        </div> 
    7157 
     
    122108  <metal:use use-macro="field_macro | here/field/macros/edit"> 
    123109   <metal:fill fill-slot="widget_body"> 
    124       <tal:define define="edit_chapter request/edit | python:0; 
    125                   edit_chapter python: int(edit_chapter); 
    126                   translation translation | python:0; 
    127                   chapter_count python:len(value); 
    128                   cleaned_chapters python:field.get(here); 
    129                   macro_mapping python:{'text_block':'here/widget_chapter/macros/%s_text_block', 
    130                     'guidelines':'here/widget_exercise/macros/%s_guidelines', 
    131                     'media_piece':'here/widget_chapter/macros/%s_media_piece', 
    132                     'embed_block':'here/widget_chapter/macros/%s_embed_block', 
    133                     'choice':'here/widget_exercise/macros/%s_choice', 
    134                     'multiple_choices':'here/widget_exercise/macros/%s_multiple_choices', 
    135                     'poll':'here/widget_exercise/macros/%s_poll', 
    136                     'fill_in_the_blanks':'here/widget_exercise/macros/%s_fill_in_the_blanks', 
    137                     'open_ended':'here/widget_exercise/macros/%s_open_ended', 
    138                     'exercise':'here/widget_exercise/macros/%s_exercise'}; 
    139                   "> 
    140         <input type="hidden" name="chapter_count" id="chapter_count" value="1" tal:attributes="value chapter_count"/> 
    141         <input type="hidden" name="chapter_edited" id="chapter_edited" value="0" tal:attributes="value edit_chapter;"/> 
    142         <input type="hidden" name="chapter_last_edited" id="chapter_last_edited" value="0" tal:attributes="value edit_chapter;"/> 
    143        <div class="sortable"> 
    144      
    145         <tal:chapters repeat="chapter value"> 
    146          <tal:definitions define="index repeat/chapter/index; 
    147           text chapter/text; 
    148           type chapter/type; 
    149           cleaned_chapter python:cleaned_chapters[index]; 
    150            "> 
    151      
    152             <a name="#" tal:attributes="name index"> </a> 
    153      
    154             <div class="section sortable_row"> 
    155                <span class="handle handle_large">&nbsp;</span> 
    156                <fieldset> 
    157                    <metal:legend use-macro="here/widget_chapter/macros/legendbuttons" /> 
    158                    <tal:view-mode condition="python:index!=edit_chapter"> 
    159                         <metal:block use-macro="python:path(macro_mapping[type] % 'edit_view')" />         
    160                    </tal:view-mode>                 
    161                   <tal:edit-mode condition="python: index==edit_chapter"> 
    162                        <a name="edit"></a> 
    163                        <metal:block use-macro="python:path(macro_mapping[type] % 'edit')" />                
    164                   </tal:edit-mode> 
    165                </fieldset> 
    166             </div> 
    167           </tal:definitions> 
    168         </tal:chapters> 
    169        </div> 
    170        <tal:buttons condition="not:translation"> 
    171      
     110      <metal:chapter_editor_block use-macro="here/widget_chapter/macros/chapter_editor" /> 
     111       <tal:buttons>     
    172112        <input class="context" 
    173113            tabindex="" 
     
    204144            /> 
    205145       </tal:buttons> 
    206       </tal:define> 
    207146   </metal:fill> 
    208147 </metal:use> 
     
    216155    <div tal:replace="structure cleaned_chapter" /> 
    217156</metal:edit_view_guidelines> 
     157 
     158<metal:edit_view_guidelines define-macro="edit_view_exercise"> 
     159    <div tal:replace="structure cleaned_chapter" /> 
     160</metal:edit_view_guidelines> 
     161 
    218162 
    219163<metal:edit_view_poll define-macro="edit_view_poll"> 
     
    299243 
    300244<metal:edit_poll define-macro="edit_poll"> 
    301 <metal:use use-macro="edit_exercise" /> 
     245<metal:use use-macro="here/widget_exercise/macros/edit_exercise" /> 
    302246</metal:edit_poll> 
    303247 
    304248<metal:edit_choice define-macro="edit_choice"> 
    305 <metal:use use-macro="edit_exercise" /> 
     249<metal:use use-macro="here/widget_exercise/macros/edit_exercise" /> 
    306250</metal:edit_choice> 
    307251 
    308252<metal:edit_multiple_choices define-macro="edit_multiple_choices"> 
    309 <metal:use use-macro="edit_exercise" /> 
     253<metal:use use-macro="here/widget_exercise/macros/edit_exercise" /> 
    310254</metal:edit_multiple_choices> 
    311255 
     
    313257<metal:edit_question define-macro="edit_exercise"> 
    314258 <div class="chapter_edit" style="height:360px">  
    315   <div class="inner_edit" id="question_selection" style="position:absolute;height:290px;width:700px;" > 
    316    <table width="90%"> 
    317      <tr><th><label i18n:translate="label_select_exercise_type">Select the exercise type:</label></th></tr> 
    318      <input type="hidden" id="chapter_type" name="chapter_type" value="" /> 
    319      <tr height="200"><td> 
    320         <ul> 
    321            <li><label><a href="void(0);" onclick="editQuestion('multiple_choice');"><tal:block i18n:translate="label_exercise_multiple_choice_question">Multiple choice question</tal:block>...</a></label></li> 
    322            <li><label><a href="void(0)" onclick="editQuestion('fill_blanks');"><tal:block i18n:translate="label_exercise_fill_in_the_blanks">Fill-in-the-blanks exercise</tal:block>...</a></label></li> 
    323            <li><label><a href="void(0)" onclick="editQuestion('open_ended');"><tal:block i18n:translate="label_exercise_open_ended">Open-ended question</tal:block>...</a></label></li> 
    324            <li><label><a href="void(0)" onclick="editQuestion('potatoes_upload');"><tal:block i18n:translate="upload_questions_from_hot_potatoes">Upload questions from Hot Potatoes</tal:block>...</a></label></li> 
    325         </ul> 
    326       </td></tr> 
    327    </table> 
    328   </div> 
     259  <metal:question_selection use-macro="here/widget_exercise/macros/question_selection" /> 
    329260  <metal:multiple_questions use-macro="here/widget_exercise/macros/multiple_questions_edit" /> 
    330261  <metal:edit_fill_in_the_blanks use-macro="here/widget_exercise/macros/edit_fill_in_the_blanks" /> 
    331262  <metal:edit_open_ended use-macro="here/widget_exercise/macros/edit_open_ended" /> 
    332263  <metal:upload_hot_potatoes use-macro="here/widget_exercise/macros/upload_hot_potatoes" /> 
    333   <div class="inner_edit" style="display:none;position:absolute;" tal:attributes="id python:'preview' % index"> 
     264  <div class="inner_edit" style="display:none;position:absolute;" id="preview"> 
    334265    <label align="center"><tal:block i18n:translate="preview">Preview</tal:block>:</label> 
    335266    <div class="innermost" style="width:700px;">replaced text</div> 
     
    340271 
    341272 
     273<metal:question_selection define-macro="question_selection"> 
     274  <div class="inner_edit" id="question_selection" tal:attributes="style python:test(chapter['type']=='exercise','display:block','')"> 
     275   <input type="hidden" id="chapter_type" name="chapter_type" value="" tal:attributes="value chapter/type" /> 
     276   <table width="90%"> 
     277     <tr><th><label i18n:translate="label_select_exercise_type">Select the exercise type:</label></th></tr> 
     278     <tr height="200"><td> 
     279        <ul> 
     280           <li><label><a href="javascript:editQuestion('multiple_choices');void(0);"><tal:block i18n:translate="label_exercise_multiple_choice_question">Multiple choice question</tal:block>...</a></label></li> 
     281           <li><label><a href="javascript:editQuestion('fill_in_the_blanks');void(0);"><tal:block i18n:translate="label_exercise_fill_in_the_blanks">Fill-in-the-blanks exercise</tal:block>...</a></label></li> 
     282           <li><label><a href="javascript:editQuestion('open_ended');void(0);"><tal:block i18n:translate="label_exercise_open_ended">Open-ended question</tal:block>...</a></label></li> 
     283           <li><label><a href="javascript:editQuestion('potatoes_upload');void(0);"><tal:block i18n:translate="upload_questions_from_hot_potatoes">Upload questions from Hot Potatoes</tal:block>...</a></label></li> 
     284        </ul> 
     285      </td></tr> 
     286   </table> 
     287  </div> 
     288</metal:question_selection> 
     289 
     290 
    342291<metal:upload_hot_potatoes define-macro="upload_hot_potatoes"> 
    343  <div class="inner_edit" style="display:none;position:absolute;height:290px;width:700px;" id="hot_potatoes_edit"> 
     292 <div class="inner_edit" id="hot_potatoes_edit" > 
    344293  <table width="100%"><tr> 
    345294   <th><label i18n:translate="upload_questions_from_hot_potatoes">Upload questions from Hot Potatoes</label></th></tr> 
     
    364313    </td></tr> 
    365314   <tr><td>   
    366       <a href="void(0)" style="align:left" onclick="questionSelection();">&lt; <tal:block i18n:translate="exercise_types">Exercise types</tal:block></a></td> 
     315      <a href="javascript:questionSelection();void(0)" style="align:left">&lt; <tal:block i18n:translate="exercise_types">Exercise types</tal:block></a></td> 
    367316    </tr> 
    368317   </table> 
     
    372321 
    373322<metal:edit_fill_in_the_blanks define-macro="edit_fill_in_the_blanks"> 
    374  <div class="inner_edit" style="display:none;position:absolute;height:290px;width:700px;" id="fill_blanks_edit"> 
     323 <div class="inner_edit" id="fill_in_the_blanks_edit" tal:attributes="style python:test(chapter['type']=='fill_in_the_blanks','display:block','')"> 
    375324   <table width="100%"> 
    376325     <tr><th colspan="2"><label i18n:translate="label_exercise_fill_in_the_blanks">Fill-in-the-blanks exercise</label></th></tr> 
     
    383332      </td></tr> 
    384333     <tr><td align="left">   
    385       <a href="void(0);" style="align:left" onclick="questionSelection();">&lt; 
     334      <a href="javascript:questionSelection();void(0);" style="align:left" >&lt; 
    386335      <tal:block i18n:translate="exercise_types">Exercise types</tal:block></a></td> 
    387       <td align="right"><a href="void(0);" style="align:right" onclick="previewFillTheBlanks();previewQuestion();"><tal:block i18n:translate="preview">Preview</tal:block>&gt; </a> 
     336      <td align="right"><a href="javascript:previewFillTheBlanks();previewQuestion();void(0);" style="align:right"><tal:block i18n:translate="preview">Preview</tal:block>&gt; </a> 
    388337     </td></tr> 
    389338  </table> 
     
    394343 
    395344<metal:edit_open_ended define-macro="edit_open_ended"> 
    396  <div class="inner_edit" style="display:none;position:absolute;height:290px;width:700px;" id="open_ended_edit"> 
     345 <div class="inner_edit" id="open_ended_edit" tal:attributes="style python:test(chapter['type']=='open_ended','display:block','')"> 
    397346 <table width="100%"><tr> 
    398347 <th colspan="2"><label>Open-ended question:</label></th></tr> 
     
    405354  <tr><td align="left">   
    406355      <a href="void(0);" style="align:left" onclick="questionSelection();">&lt; <tal:block i18n:translate="exercise_types">Exercise types</tal:block></a></td> 
    407       <td align="right"><a href="void(0)" style="align:right" onclick="previewOpenEnded();previewQuestion();"><tal:block i18n:translate="preview">Preview</tal:block>&gt; </a> 
     356      <td align="right"><a href="javascript:previewOpenEnded();previewQuestion();void(0);" style="align:right"><tal:block i18n:translate="preview">Preview</tal:block>&gt; </a> 
    408357   </td></tr> 
    409358  </table> 
     
    414363 
    415364<metal:multiple_questions define-macro="multiple_questions_edit"> 
    416 <div class="inner_edit" style="display:none; position:absolute;height:290px;width:700px;" id="multiple_choice_edit"> 
     365<div class="inner_edit" id="multiple_choices_edit" tal:attributes="style python:test(chapter['type'] in ['multiple_choices','choices'],'display:block','')"> 
    417366 <table width="100%"> 
    418367    <tr><th colspan="2"><label i18n:translate="label_exercise_multiple_choice_question">Create a multiple choice question</label></th></tr> 
     
    423372    <td> 
    424373     <div class="translatedText" tal:condition="translation"><metal:tra use-macro="here/widget_chapter/macros/original_text" /></div> 
    425          <textarea rows="3" id="choice_question" name="choice_question" tal:attributes="tabindex tabindex/next;" tal:content="question"></textarea> 
     374         <textarea rows="3" id="choice_question" name="choice_question" tal:attributes="tabindex tabindex/next;" tal:content="chapter/text"></textarea> 
    426375     </td></tr> 
    427376    <tr><td width="40%">  
     
    476425     <tr><td align="left">   
    477426        <a href="javascript:void(0)" style="align:left" onclick="questionSelection();">&lt; <tal:block i18n:translate="exercise_types">Exercise types</tal:block></a></td> 
    478         <td align="right"><a href="javascript:void(0)" style="align:right" onclick="previewMultipleChoice();previewQuestion();"><tal:block i18n:translate="preview">Preview</tal:block>&gt; </a> 
     427        <td align="right"><a href="javascript:previewMultipleChoice();previewQuestion();void(0)" style="align:right"><tal:block i18n:translate="preview">Preview</tal:block>&gt; </a> 
    479428     </td></tr> 
    480429  </table> 
Note: See TracChangeset for help on using the changeset viewer.