Changeset 1345


Ignore:
Timestamp:
02/06/07 16:15:37 (13 years ago)
Author:
jukka
Message:

Fixed #1128, refactored portlets with sane condition-statements.

Location:
trunk/skins/lemill
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/skins/lemill/portlet_activity_actions.pt

    r1261 r1345  
    44<body> 
    55<div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="no_edit_links here/REQUEST/version|nothing; 
    7                     path_end python:here.REQUEST['URL'].split('/')[-1]; 
    8                     is_History python:path_end=='history_view'; 
    9                     is_Translation python:path_end=='show_translations';"> 
     6        tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
     7                    is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
     8                    is_Translation python:path_end=='show_translations'; 
     9                    is_owner here/amIOwner; 
     10                    can_moderate here/canIModerate;"> 
    1011 
    1112<tal:visible condition="python:wf_state!='deleted'"> 
    12     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/image_div"/> 
     13    <div class="tb-portlet" metal:define-macro="image_div"> 
     14        <p style="text-align: center;" tal:condition="python: is_History or is_Translation"><a href="" tal:define="myUrl python: context.absolute_url()" tal:attributes="href string: ${myUrl}/view"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></a></p> 
     15        <p style="text-align: center;" tal:condition="python: not (is_History or is_Translation)"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></p> 
     16        <tal:editable tal:condition="not:is_History"> 
     17        <ul metal:define-slot="image_edit" tal:condition="is_editable"> 
     18            <li > 
     19                <a  href="" tal:attributes="href string:${here_url}/change_coverimage"><tal:block i18n:translate="label_change_cover_image">Change cover image</tal:block>...</a> 
     20            </li> 
     21        </ul> 
     22        </tal:editable> 
     23    </div> 
    1324 
     25    <tal:history condition="is_History"> 
     26    <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
     27    </tal:history> 
     28     
    1429    <tal:hide condition="not:is_History"> 
    1530    <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/edit_div"/> 
  • trunk/skins/lemill/portlet_lemillreference_actions.pt

    r1286 r1345  
    33      i18n:domain="lemill"> 
    44<body> 
    5 <div metal:define-macro="portlet" id="portlet-material-actions"         tal:define="no_edit_links here/REQUEST/version|nothing; 
    6                     path_end python:here.REQUEST['URL'].split('/')[-1]; 
    7                     is_History python:path_end=='history_view'; 
    8                     is_Translation python:path_end=='show_translations';"> 
     5<div metal:define-macro="portlet" id="portlet-material-actions" 
     6        tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
     7                    is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
     8                    is_Translation python:path_end=='show_translations'; 
     9                    is_owner here/amIOwner; 
     10                    can_moderate here/canIModerate;"> 
    911 
    1012<tal:visible condition="python:wf_state!='deleted'"> 
    1113 
    12 <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/image_div"> 
    13 <tal:block metal:fill-slot="image_edit"> 
    14     <ul> 
    15         <li> 
    16             <a  href="" tal:attributes="href string:${here_url}/change_coverimage"><tal:block i18n:translate="label_change_cover_image">Change cover image</tal:block>...</a> 
    17         </li> 
    18     </ul> 
    19 </tal:block> 
    20 </div> 
     14<div class="tb-portlet" metal:use-macro="here/portlet_activity_actions/macros/image_div" /> 
     15 
     16    <tal:history condition="is_History"> 
     17    <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
     18    </tal:history> 
    2119 
    2220    <tal:hide condition="not:is_History"> 
  • trunk/skins/lemill/portlet_material_actions.pt

    r1320 r1345  
    44<body> 
    55    <div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="no_edit_links here/REQUEST/version|nothing; 
    7                     path_end python:here.REQUEST['URL'].split('/')[-1]; 
    8                     is_History python:path_end=='history_view'; 
    9                     is_Translation python:path_end=='show_translations';"> 
     6        tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
     7                    is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
     8                    is_Translation python:path_end=='show_translations'; 
     9                    can_moderate here/canIModerate; 
     10                    is_owner here/amIOwner;"> 
    1011 
    1112<tal:visible condition="python:wf_state!='deleted'"> 
    1213 
    13 <div class="tb-portlet" metal:define-macro="image_div" tal:define="is_Version python: request.get('version');"> 
    14     <p style="text-align: center;" tal:condition="python: is_History or is_Translation or is_Version"><a href="" tal:define="myUrl python: context.absolute_url()" tal:attributes="href string: ${myUrl}/view"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></a></p> 
    15     <p style="text-align: center;" tal:condition="python: not (is_History or is_Version or is_Translation)"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></p> 
    16     <ul metal:define-slot="image_edit" tal:condition="python:is_editable and not no_edit_links"> 
    17         <li tal:condition="python:wf_state=='public'"> 
     14<div class="tb-portlet" metal:define-macro="image_div"> 
     15    <p style="text-align: center;" tal:condition="python: is_History or is_Translation"><a href="" tal:define="myUrl python: context.absolute_url()" tal:attributes="href string: ${myUrl}/view"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></a></p> 
     16    <p style="text-align: center;" tal:condition="python: not (is_History or is_Translation)"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></p> 
     17    <tal:editable tal:condition="not:is_History"> 
     18    <ul metal:define-slot="image_edit" tal:condition="python:wf_state=='public' and (is_editable or can_moderate)"> 
     19        <li tal:condition="is_editable"> 
    1820            <a  href="" tal:attributes="href string:${here_url}/change_coverimage"><tal:block i18n:translate="label_change_cover_image">Change cover image</tal:block>...</a> 
    1921        </li> 
    20         <li tal:condition="python:wf_state=='draft' and (here.amIOwner() or here.canIModerate())"> 
     22        <li tal:condition="python:is_owner or can_moderate"> 
     23            <a href="" tal:attributes="href string:$here_url/retract"><tal:block i18n:domain="lemill" i18n:translate="Change to draft">Change to draft</tal:block></a> 
     24        </li> 
     25    </ul> 
     26    <ul tal:condition="python:wf_state=='draft' and (is_owner or can_moderate)"> 
     27        <li> 
    2128            <a href="" tal:attributes="href string:$here_url/lemill_ask_publish"><tal:block i18n:domain="plone" i18n:translate="Publish">Publish</tal:block>...</a> 
    2229        </li> 
    23         <li tal:condition="python:wf_state=='public' and not no_edit_links and here.amIMaterial() and (here.amIOwner() or here.canIModerate())"> 
    24             <a href="" tal:attributes="href string:$here_url/retract"><tal:block i18n:domain="lemill" i18n:translate="Change to draft">Change to draft</tal:block></a> 
    25         </li> 
     30    </ul> 
     31    </tal:editable> 
     32</div> 
    2633 
     34<tal:history condition="is_History"> 
     35<div class="tb-portlet" metal:define-macro="history_div"> 
     36    <ul tal:condition="python:path_end!='history_view'"> 
     37        <li><a href="" i18n:translate="label_view_history" tal:attributes="href string:${here_url}/history_view">History</a></li> 
    2738    </ul> 
    2839</div> 
     40</tal:history> 
    2941 
    30 <tal:hide condition="not:is_History"> 
     42<tal:not_history condition="not:is_History"> 
    3143<div class="tb-portlet" metal:define-macro="edit_div"> 
    3244    <ul> 
    33         <li tal:condition="not:no_edit_links"> 
     45        <li> 
    3446            <a href="" i18n:domain="plone" 
    3547                tal:attributes="href python:test(is_editable, here_url+'/edit',  
     
    3850        <li><a href="" i18n:translate="label_view_history" tal:attributes="href string:${here_url}/history_view">History</a></li> 
    3951        <!--li tal:condition="python:(context.amIOwner() or here.canIModerate()) and here.amIMaterial() and not no_edit_links"><a href="TODO"><tal:block i18n:translate="label_transfer_authorship">Transfer authorship</tal:block>...</a></li--> 
    40         <li metal:define-macro="delete_action" tal:condition="python:(context.amIOwner() or here.canIModerate()) and not no_edit_links"> 
     52        <li metal:define-macro="delete_action" tal:condition="python:is_owner or can_moderate"> 
    4153           <a href="" i18n:domain="plone" tal:attributes="href string:${here_url}/delete" class="deleteLinkColor"><tal:block i18n:translate="Delete">Delete</tal:block>...</a> 
    4254        </li> 
     
    4456</div> 
    4557 
    46 <div class="tb-portlet" metal:define-macro="collections_div" tal:condition="python:colls or not isAnon and not no_edit_links" tal:define="colls python:context.community.getCollections(obj_uid=context.UID())"> 
     58<div class="tb-portlet" metal:define-macro="collections_div" tal:condition="python:colls or not isAnon" tal:define="colls python:context.community.getCollections(obj_uid=context.UID())"> 
    4759    <ul> 
    4860    <tal:macro metal:define-macro="collection_actions"> 
    49         <li tal:condition="python: not isAnon and not no_edit_links"><a href="" tal:attributes="href python:str(here.absolute_url())+'/collection_add'"><tal:block i18n:translate="label_add_to_collection">Add to collection</tal:block>...</a></li> 
     61        <li tal:condition="not:isAnon"><a href="" tal:attributes="href python:str(here.absolute_url())+'/collection_add'"><tal:block i18n:translate="label_add_to_collection">Add to collection</tal:block>...</a></li> 
    5062        <li tal:condition="colls"> 
    5163            <a href=""  i18n:translate="label_view_collections" 
     
    6173<tal:macro metal:define-macro="translate_actions"> 
    6274<tal:translations tal:condition="python:wf_state != 'deleted' and context.meta_type not in ['Piece', 'LeMillReference']"> 
    63 <div class="tb-portlet" tal:condition="python:(not isAnon and not no_edit_links and wf_state=='public') or here.getTranslations()" tal:define="translation_of here/getOriginal"> 
     75<div class="tb-portlet" tal:condition="python:(not isAnon and wf_state=='public') or here.getTranslations()" tal:define="translation_of here/getOriginal"> 
    6476    <ul> 
    65         <li tal:condition="python: not isAnon and not no_edit_links and wf_state=='public'"><a href="" tal:attributes="href python:'%s/translate_resource' % here_url"><tal:block i18n:translate="label_translate">Translate</tal:block>...</a></li> 
     77        <li tal:condition="python: not isAnon and wf_state=='public'"><a href="" tal:attributes="href python:'%s/translate_resource' % here_url"><tal:block i18n:translate="label_translate">Translate</tal:block>...</a></li> 
    6678        <li tal:condition="translation_of"> 
    6779            <a href="" tal:attributes="href translation_of/absolute_url" i18n:translate="link_original_translated">Original</a> 
     
    93105 
    94106 
    95 <div class="tb-portlet" metal:define-macro="view_div" tal:condition="python: here.amIMaterial() and not no_edit_links"> 
     107<div class="tb-portlet" metal:define-macro="view_div" tal:condition="python: here.amIMaterial()"> 
    96108    <ul> 
    97109        <li><a i18n:translate="label_student_view" tal:attributes="href string:${here_url}">Student view</a></li> 
     
    101113 
    102114<tal:comment replace="nothing"> 
    103 <div class="tb-portlet" metal:define-macro="owner_div" tal:condition="python:wf_state=='public' and context.lemill_tool.portal_integration and context.meta_type in context.getMaterialTypes() and not no_edit_links"> 
     115<div class="tb-portlet" metal:define-macro="owner_div" tal:condition="python:wf_state=='public' and context.lemill_tool.portal_integration and context.meta_type in context.getMaterialTypes()"> 
    104116    <ul>        
    105117    <li> 
     
    110122</tal:comment> 
    111123 
    112 </tal:hide> 
     124</tal:not_history> 
    113125</tal:visible> 
    114126<tal:deleted condition="python:wf_state=='deleted'"> 
    115     <div class="tb-portlet" tal:condition="python:context.amIOwner() or here.canIModerate() and not no_edit_links" metal:define-macro="restore_div"> 
     127    <div class="tb-portlet" tal:condition="python:context.amIOwner() or here.canIModerate() and not is_History" metal:define-macro="restore_div"> 
    116128        <ul> 
    117129            <li><a i18n:translate="label_restore_or_undelete" href="" tal:attributes="href string:${here_url}/rescue">Restore deleted</a></li> 
  • trunk/skins/lemill/portlet_piece_actions.pt

    r1286 r1345  
    44<body> 
    55<div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="no_edit_links here/REQUEST/version|nothing; 
    7                     path_end python:here.REQUEST['URL'].split('/')[-1]; 
    8                     is_History python:path_end=='history_view'; 
    9                     is_Translation python:path_end=='show_translations';"> 
     6        tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
     7                    is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
     8                    is_Translation python:path_end=='show_translations'; 
     9                    is_owner here/amIOwner; 
     10                    can_moderate here/canIModerate;"> 
    1011<tal:visible condition="python:wf_state!='deleted'"> 
    11     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/image_div"> 
     12    <div class="tb-portlet" metal:use-macro="here/portlet_activity_actions/macros/image_div"> 
    1213        <tal:block metal:fill-slot="image_edit"></tal:block> 
    1314    </div> 
     15 
     16    <tal:history condition="is_History"> 
     17    <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
     18    </tal:history> 
    1419 
    1520    <tal:hide condition="not:is_History"> 
  • trunk/skins/lemill/portlet_tool_actions.pt

    r1261 r1345  
    44<body> 
    55<div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="no_edit_links here/REQUEST/version|nothing; 
    7                     path_end python:here.REQUEST['URL'].split('/')[-1]; 
    8                     is_History python:path_end=='history_view'; 
    9                     is_Translation python:path_end=='show_translations';"> 
     6        tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
     7                    is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
     8                    is_Translation python:path_end=='show_translations'; 
     9                    is_owner here/amIOwner; 
     10                    can_moderate here/canIModerate;"> 
    1011<tal:visible condition="python:wf_state!='deleted'"> 
    11     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/image_div"/> 
     12    <div class="tb-portlet" metal:use-macro="here/portlet_activity_actions/macros/image_div"/> 
     13 
     14    <tal:history condition="is_History"> 
     15    <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
     16    </tal:history> 
    1217 
    1318    <tal:hide condition="not:is_History"> 
Note: See TracChangeset for help on using the changeset viewer.