source: trunk/skins/lemill/portlet_material_actions.pt @ 1309

Revision 1309, 7.6 KB checked in by pjotr, 13 years ago (diff)

Fixes #1110, now all the div is hidden if the resource is not published yet

Line 
1<html xmlns:tal="http://xml.zope.org/namespaces/tal"
2      xmlns:metal="http://xml.zope.org/namespaces/metal"
3      i18n:domain="lemill">
4<body>
5    <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';">
10
11<tal:visible condition="python:wf_state!='deleted'">
12
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'">
18            <a  href="" tal:attributes="href string:${here_url}/change_coverimage"><tal:block i18n:translate="label_change_cover_image">Change cover image</tal:block>...</a>
19        </li>
20        <li tal:condition="python:wf_state=='draft' and (here.amIOwner() or here.canIModerate())">
21            <a href="" tal:attributes="href string:$here_url/lemill_ask_publish"><tal:block i18n:domain="plone" i18n:translate="Publish">Publish</tal:block>...</a>
22        </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>
26
27    </ul>
28</div>
29
30<tal:hide condition="not:is_History">
31<div class="tb-portlet" metal:define-macro="edit_div">
32    <ul>
33        <li tal:condition="not:no_edit_links">
34            <a href="" i18n:domain="plone"
35                tal:attributes="href python:test(is_editable, here_url+'/edit',
36                    test(isAnon, 'login_form', here_url+'/join_a_group'))"><tal:block i18n:translate="label_edit">Edit</tal:block>...</a>
37        </li>
38        <li><a href="" i18n:translate="label_view_history" tal:attributes="href string:${here_url}/history_view">History</a></li>
39        <!--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">
41           <a href="" i18n:domain="plone" tal:attributes="href string:${here_url}/delete" class="deleteLinkColor"><tal:block i18n:translate="Delete">Delete</tal:block>...</a>
42        </li>
43    </ul>
44</div>
45
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())">
47    <ul>
48    <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>
50        <li tal:condition="colls">
51            <a href=""  i18n:translate="label_view_collections"
52                tal:attributes="href string:${context/community/absolute_url}/collections_list?obj_id=${context/UID}">
53                View collections</a>
54            <span tal:replace="python:'('+str(len(colls))+')'">(1)</span>
55        </li>
56    </tal:macro>
57        <tal:comment replace="nothing"><li><a i18n:translate="label_read_tips" href="TODO">Read Tips for Use</a></li></tal:comment>       
58    </ul>
59</div>
60
61<tal:macro metal:define-macro="translate_actions">
62<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">
64    <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>
66        <li tal:condition="translation_of">
67            <a href="" tal:attributes="href translation_of/absolute_url" i18n:translate="link_original_translated">Original</a>
68            (<span tal:replace="python:here.script_getPrettyLanguage(translation_of.Language())"/>)
69        </li>
70        <li tal:condition="here/getTranslations">
71            <a href="show_translations" tal:attributes="href string:${here/absolute_url}/show_translations">
72                <span i18n:translate="label_translations" tal:omit-tag="">Translations</span></a>
73                (<tal:n replace="python:len(context.getTranslations())"></tal:n>)
74           <tal:notAnons condition="not:isAnon">
75               <ul tal:define="member_folder python: mtool.getHomeFolder(member.getId());
76                               user_langs member_folder/getLanguage_skills"
77                   tal:condition="user_langs">
78                   <tal:trans repeat="rr context/getTranslations">
79                    <tal:defs tal:define="tlang python:rr.Language()">
80                     <li tal:condition="python:tlang in user_langs and tlang!=context.Language()">
81                      <a href="" tal:content="python:here.script_getPrettyLanguage(tlang)" tal:attributes="href rr/absolute_url | nothing"></a>
82                     </li>
83                     <li tal:condition="python:tlang==context.Language()" tal:content="python:here.script_getPrettyLanguage(tlang)" />
84                    </tal:defs>                 
85                   </tal:trans>
86               </ul>
87           </tal:notAnons>
88        </li>
89    </ul>
90</div>
91</tal:translations>
92</tal:macro>
93
94
95<div class="tb-portlet" metal:define-macro="view_div" tal:condition="python: here.amIMaterial() and not no_edit_links">
96    <ul>
97        <li><a i18n:translate="label_student_view" tal:attributes="href string:${here_url}">Student view</a></li>
98    </ul>
99</div>
100
101
102<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">
104    <ul>       
105    <li>
106    <a href="TODO" i18n:translate="label_publish_in_portal">Publish in portal</a>
107    </li>
108    </ul>
109</div>
110</tal:comment>
111
112</tal:hide>
113</tal:visible>
114<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">
116        <ul>
117            <li><a i18n:translate="label_restore_or_undelete" href="" tal:attributes="href string:${here_url}/rescue">Restore deleted</a></li>
118        </ul>
119    </div>
120</tal:deleted>
121
122</div>
123</body>
124</html>
125
Note: See TracBrowser for help on using the repository browser.