EduploneExam/skins/EduploneExam exam_fillgap_edit.cpt,NONE,1.1

Nils Haagen <[email protected]> Thu, 31 Mar 2005 00:19:59 +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-serv1810

Added Files:
	exam_fillgap_edit.cpt 
Log Message:
js/css stuff for nice editing of gaps

--- NEW FILE: exam_fillgap_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="plone">

  <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>

  <style metal:fill-slot="css_slot">
        type="text/css"
        media="all">

       .exam_fg_highlighted { 
            background-color:#cccccc; i do not know, why this is... firefox seems to ignore first class}
    
       .exam_fg_isGap { 
            background-color:#dedede; }

       .exam_fg_highlighted { 
            background-color:#ee9900; }
    
  </style>


  <script metal:fill-slot="javascript_head_slot" language="javascript">
   
      function highlightGap(nr){
        oldNr=document.forms['gapEditForm'].gapWordIndex.value;
        if(oldNr){
            document.getElementById('gapLink_' + oldNr ).style.backgroundColor='#FFFFFF';
        }

        document.forms['gapEditForm'].gapWordIndex.value=nr;
        gL=document.getElementById('gapLink_' + nr);
        gL.style.backgroundColor='#ee9900';
      }

  </script>

    <metal:fill fill-slot="main">
      <metal:main define-macro="main">
        <metal:use_header use-macro="header_macro" />
        <metal:use_typedescription use-macro="typedescription_macro" />
   
          <fieldset tal:define="BaseTextList python: here.aq_parent.getBasetext().split(' ')">
            <legend>BaseText</legend>

              <tal:block tal:repeat="word BaseTextList">
              <tal:def tal:define="isCurrent python:word=='<id=\'%s\'>' % here.getId();
                                   isGap     python:word.startswith('<id=') and word.endswith('>');">

                  <a tal:condition="isCurrent"
                     tal:attributes="href  python:'javascript:highlightGap(%i)' % (repeat['word'].index);
                                     class string:exam_fg_highlighted;
                                     id  python:'gapLink_%s' % (str(repeat['word'].index));"
                     tal:content="python: here.Title()" />

                  <a tal:condition="python:isGap and not isCurrent"
                     tal:attributes="href  python:''.join([here.aq_parent[word[5:-2]].absolute_url() , '/exam_fillgap_edit']);
                                     class string:exam_fg_isGap;
                                     id  python:'gapLink_%s' % (str(repeat['word'].index));"
                     tal:content="python: here.aq_parent[word[5:-2]].Title()" />

                  <a tal:condition="python:isGap==False"
                     tal:attributes="href  python:'javascript:highlightGap(%i)' % (repeat['word'].index);
                                     id  python:'gapLink_%s' % (str(repeat['word'].index));"
                     tal:content="word" />



              </tal:def>
              </tal:block>

          </fieldset>

          <br />


<form name="gapEditForm">
          
          new:<input type="text" name="gapWordIndex" tal:attributes="value python:here.getGapPosition(here.getId())"/>

          <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>
</form>

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

  </body>

</html>

</tal:block>



-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30