<span metal:define-macro="note_display_content" tal:omit-tag="">
	<div style="width:100%" tal:condition="python:not(note.is_censored()) or context.kas_opetaja(request)">
    	<span tal:omit-tag="" tal:define="global table_colour string:#EEEEEE" />
    	<span tal:omit-tag="" tal:condition="python:not(note.is_reader(str(user))) and note.is_temporary()!=True">
    		<span tal:omit-tag="" tal:define="global table_colour string:#AAAAAA" />
			<a href="" tal:condition="python:context.get_n_unread_notes(str(user))>note_counter and request.SESSION['show_body']" tal:attributes="href string:#new${note_counter}" tal:on-error="string:">
				<img src="images/arrow_down1" 
					height="7" width="11" border="0" hspace="5" 
					alt="next unread message" 
					title="next unread message" 
					i18n:attributes="alt;title" />
				<label tal:omit-tag="" i18n:translate="">Go to next unread</label>
			</a>
    	</span>
	<table border="0" cellpadding="4" cellspacing="0" width="100%" style="background-color:#AAAAAA" tal:attributes="style string:background-color:${table_colour}">
		<tr>
			<td style="width:70%;text-align:left">
				<img tal:replace="structure python:note.get_tt_icon_tag(request)" />
				<span style="font-style:italic" tal:content="note/get_tt_name" />
				<br />
				<strong tal:content="python:note.get_subject(request)" />
			</td>
			<td style="width:25%;text-align:right">
				<strong tal:content="python:note.get_nickname_with_role_name(note.get_author())" />
				<br />
				<span style="font-style:italic" tal:content="python:note.get_printable_creation_time(request)" />
			</td>
			<td style="width:5%">
				<img tal:condition="not:context/uses_roleplay_only" tal:replace="structure python:here.fle_root().fle_users.get_user_info(note.get_author()).get_photo_tag(request, height='40')" />
			</td>
		</tr>
		<tr>
			<td colspan="3" style="background-color:white">
				<div style="text-align:right;font-weight:100;color:gray">
					<a href="list_readers" i18n:translate="">statistics</a> 
					| <a href="note_edit_form" i18n:translate="">edit</a> 
					| <a href="note_hide" tal:condition="python:note.may_censor_note(str(user))">
						<label tal:omit-tag="" tal:condition="not:note/is_censored" i18n:translate="">hide</label>
						<label tal:omit-tag="" tal:condition="note/is_censored" i18n:translate="">unhide</label>
					  </a>
				</div>
				<label tal:replace="structure python:note.get_render_body(request)" />
				<span tal:omit-tag="" tal:condition="note/has_image">
					<p><img src="" tal:attributes="src string:${note/hack_absolute_url}/get_image_data" /></p>
					<p><strong tal:content="note/get_image_name" /></p>
				</span>
				<span tal:omit-tag="" tal:condition="note/get_url">
					
					<a tal:condition="note/get_url_name" href="" target="_blank" tal:attributes="href note/get_url" tal:content="note/get_url_name"></a>
					<a tal:condition="not:note/get_url_name" href="" target="_blank" tal:attributes="href note/get_url" tal:content="note/get_url"></a>

				</span>
				<br />&nbsp;
			</td>
		</tr>
</table>
</div>

</span>

<span metal:define-macro="thread_tree_printer" tal:omit-tag="">
<!--		<span tal:condition="not:request/SESSION/show_body" tal:replace="structure string:<ul>" />-->
		<span tal:replace="structure string:<ul>" />

		<br tal:condition="request/SESSION/show_body" />
		<li tal:condition="python:not(request.SESSION['show_body']) and (not(pn.is_censored()) or here.kas_opetaja(request))"><!-- tal:omit-tag="request/SESSION/show_body">-->
			<img tal:replace="structure python:pn.get_tt_icon_tag(request)" tal:condition="not:pn/is_censored" />
			<strong tal:omit-tag="python:pn.is_reader(str(user)) or pn.is_censored()">
    			<span tal:omit-tag="" tal:condition="not:pn/is_censored">( <label tal:omit-tag="" tal:content="pn/get_tt_abbreviation" /> )</span>
    			<a tal:omit-tag="python:pn.absolute_url()+'/note_index_html'==request.URL0" href="" tal:attributes="href string:${pn/absolute_url}/" tal:content="pn/get_subject" />
				<span tal:omit-tag="" tal:condition="not:pn/is_censored">
        			/ <label tal:omit-tag="" tal:content="python:pn.get_nickname_with_role_name(pn.get_author())" />
        			/ <label tal:omit-tag="" tal:content="python:pn.get_printable_creation_time(request)" />
				</span>
			</strong>
			<span tal:omit-tag="" tal:condition="python:request.SESSION['show_body']!=1 and request.SESSION['only_start']!=1">
				( <strong> 
					<label tal:omit-tag="" tal:content="python:pn.get_n_unread_notes(str(user))" />
					<label tal:omit-tag="" i18n:translate="">new messages</label>
					</strong> / <label tal:omit-tag="" tal:content="python:pn.get_n_notes()" />
				  <label tal:omit-tag="" i18n:translate="">messages</label>)
			</span>
		</li>
		
			<span tal:condition="request/SESSION/show_body" tal:omit-tag="" tal:define="note pn">
				<a tal:condition="python:not(pn.is_reader(str(user)))" name="" 
					tal:attributes="name string:new${note_counter}"><span tal:omit-tag="" tal:define="global note_counter python:note_counter+1" />&nbsp;</a>
				<label metal:use-macro="container/printer_macro/macros/note_display_content" />
			</span>
			
    		<span tal:omit-tag="" tal:condition="python:pn.get_children('Note') and request.SESSION['only_start']">
			  <span tal:omit-tag="" tal:repeat="xn python:pn.get_children('Note')">
			  	<span tal:define="pn xn">
	    		 	<span tal:omit-tag="" metal:use-macro="container/printer_macro/macros/thread_tree_printer" />
				</span>
			  </span>
    		</span>
<!--		<span tal:condition="not:request/SESSION/show_body" tal:replace="structure string:</ul>" />-->
		<span tal:replace="structure string:</ul>" />
</span>

<span metal:define-macro="type_tree_printer" tal:omit-tag="">
	<br />
	<span tal:omit-tag="" tal:repeat="bt context/get_data_by_tt">
		<img tal:replace="structure python:bt[1][0]['obj'].get_tt_icon_tag(request)" />
		<strong tal:content="python:bt[0].get_name()" />
		<p>
			<span tal:omit-tag="" tal:repeat="tn python:bt[1]">
				<li tal:condition="python:not(request.SESSION['show_body']) and (not(tn['obj'].is_censored()) or here.kas_opetaja(request))">
					<strong tal:omit-tag="python:tn['obj'].is_reader(str(user))">
    					<a href="" tal:attributes="href string:${tn/obj/absolute_url}/" tal:content="tn/obj/get_name" />
    					/ <label tal:omit-tag="" tal:content="python:tn['obj'].get_nickname_with_role_name(tn['obj'].get_author())" />
        				/ <label tal:omit-tag="" tal:content="python:tn['obj'].get_printable_creation_time(request)" />
					</strong>
				</li>
				<br tal:condition="request/SESSION/show_body" />
					<span tal:condition="python:request.SESSION['show_body'] and (not(tn['obj'].is_censored()) or here.kas_opetaja(request))" tal:omit-tag="" tal:define="note tn/obj">
						<a tal:condition="python:not(note.is_reader(str(user)))" name="" 
						tal:attributes="name string:new${note_counter}"><span tal:omit-tag="" tal:define="global note_counter python:note_counter+1" />&nbsp;</a>
						<label metal:use-macro="container/printer_macro/macros/note_display_content" />
					</span>
			</span>
		</p>
	</span>
</span>

<span metal:define-macro="person_tree_printer" tal:omit-tag="">
	<br />
	<span tal:omit-tag="" tal:repeat="bt context/get_data_by_author">
		<img tal:condition="not:context/uses_roleplay_only" tal:replace="structure python:here.fle_root().fle_users.get_user_info(bt[0]).get_photo_tag(request, height='40')" />
		<strong tal:content="python:context.get_nickname_with_role_name(bt[0])" />
		<p>
			<span tal:omit-tag="" tal:repeat="tn python:bt[1]">
				<li tal:condition="python:not(request.SESSION['show_body']) and (not(tn['obj'].is_censored()) or here.kas_opetaja(request))">
					<strong tal:omit-tag="python:tn['obj'].is_reader(str(user))">
    					<img tal:replace="structure python:tn['obj'].get_tt_icon_tag(request)" />
    					( <label tal:omit-tag="" tal:content="tn/obj/get_tt_abbreviation" /> )
    					<a href="" tal:attributes="href string:${tn/obj/absolute_url}/" tal:content="tn/obj/get_name" />
    					/ <label tal:omit-tag="" tal:content="python:tn['obj'].get_printable_creation_time(request)" />
					</strong>
				</li>
				<br tal:condition="request/SESSION/show_body" />
					<span tal:condition="python:request.SESSION['show_body'] and (not(tn['obj'].is_censored()) or here.kas_opetaja(request))" tal:omit-tag="" tal:define="note tn/obj">
						<a tal:condition="python:not(note.is_reader(str(user)))" name="" 
						tal:attributes="name string:new${note_counter}"><span tal:omit-tag="" tal:define="global note_counter python:note_counter+1" />&nbsp;</a>
						<label metal:use-macro="container/printer_macro/macros/note_display_content" />
					</span>
			</span>
		</p>
	</span>
</span>

<span metal:define-macro="date_tree_printer" tal:omit-tag="">
	<br />
	<span tal:omit-tag="" tal:repeat="bt context/get_data_by_date">
		<strong tal:content="python:context.get_printable_day(bt[0]*86400,request)" />
		<p>
			<span tal:omit-tag="" tal:repeat="tn python:bt[1]">
				<li tal:condition="python:not(request.SESSION['show_body']) and (not(tn['obj'].is_censored()) or here.kas_opetaja(request))">
					<strong tal:omit-tag="python:tn['obj'].is_reader(str(user))">
    					<img tal:replace="structure python:tn['obj'].get_tt_icon_tag(request)" />
    					( <label tal:omit-tag="" tal:content="tn/obj/get_tt_abbreviation" /> )
    					<a href="" tal:attributes="href string:${tn/obj/absolute_url}/" tal:content="tn/obj/get_name" />
    					/ <label tal:omit-tag="" tal:content="python:tn['obj'].get_nickname_with_role_name(tn['obj'].get_author())" />
					</strong>
				</li>
				<br tal:condition="request/SESSION/show_body" />
					<span tal:condition="python:request.SESSION['show_body'] and (not(tn['obj'].is_censored()) or here.kas_opetaja(request))" tal:omit-tag="" tal:define="note tn/obj">
						<a tal:condition="python:not(note.is_reader(str(user)))" name="" 
						tal:attributes="name string:new${note_counter}"><span tal:omit-tag="" tal:define="global note_counter python:note_counter+1" />&nbsp;</a>
						<label metal:use-macro="container/printer_macro/macros/note_display_content" />
					</span>
			</span>
		</p>
	</span>
</span>
