# this is _msgs_wide.js

||ifequal||sid||0||
auth_error('||auth_fail_reason||');
||else||

# Need to know our current folder "type"
||if(equal(search_type,(imap)))||
#	hack it for now - if not good enough needs to be output on a per message basis instead	
	||define||fld_type||1||
||else||
	||tcmd_load_fld_info||
||endif||
||define||show_star||true||
#||define||show_from||true||
||if(search)||
	||define||show_fld||true||
||endif||
||define||show_size||true||
||define||show_att||true||
||define||show_sel||true||

#MSG_LIST as old_syntax
setMessages('<span><table id="x_msgs_table" class="msgs_table wide_list ||if(not(istrue(widenew_disable)))||wide_new_format||endif|| ||if(istrue(list_msg_animation_dev))||list_animate_in||endif||" style="width:100%;table-layout:fixed;">\
		<colgroup>\
||iftrue(widenew_disable)||\
	||ifdef||show_star||\
			<col style="width:16px;">\
	||endif||\
	||ifdef||show_sel||\
			<col style="width:20px;">\
	||endif||\
			<col style="width:15px;">\
||else||\
	<col style="width:22px;">\
||endif||\
			<col style="width:100%;">\
	||ifdef||show_from||\
			<col style="width:40%;">\
			<col style="width:20%;">\
	||endif||\
		</colgroup>\
	','\
||undef||done_some||\
||begin_list_messages||\
	||ifndef||done_some||\
		||define||first_item||msg_id||\
	||endif||\
	||define||done_some||true||\
   ||ifdef||msg_separator||\
	<tr class="nonselect_row"><td colspan="||iftrue(widenew_disable)||4||else||2||endif||" class="separator_left">||msg_separator||</td></tr>\
   ||endif||\
   ||iftrue(custom_row)||\
    <tr class="custom_row">\
    	<td><input class="ws_checkbox" type="checkbox" id="sel_||msg_id||" /></td>\
    	<td>Unselectable custom list item (eg title, grouping, advert, or whatever)</td>\
    </tr>\
   ||else||\
	<tr class="\
	||iftrue(nonselect_row)||nonselect_row||endif|| \
	||iftrue(multi_row)||multi_row||endif|| \
	msgs_line ||iftrue(h_unread)||msg_unread||endif|| ||iftrue(h_recent)||msg_recent||endif|| ||h_replied|| ||if(and(equal(fld_type,3),not(blank(search))))||msg_sent||endif||" ||iftrue(h_draft)||msg_draft="true" ||endif||  from_email="||web_encode_js(h_from_short)||" timestamp="||msg_xdate2||" msg_id="||msg_id||">\
||iftrue(widenew_disable)||\
	||ifdef||show_star||\
	  <td class="mi" valign="top"><div style="margin-top:6px;"><div class="star \
	||iftrue(h_deferred)||\
	 ||iftrue(h_returned)|| star_blue||else|| deferred||endif||\
	||endif||\
	||iftrue(h_flagged)|| star_sel||endif||\
	  "></div></div></td>\
	||endif||\
	||ifdef||show_sel||\
	  <td class="mi" valign="top"><div style="margin-top:5px;"><input type="checkbox" id="sel_||msg_id||" /></div></td>\
	||endif||\
	  <td class="mi" valign="top"><div class="x_replied" style="margin-top:5px;"></div></td>\
||else||\
	||define||icon_align||bottom||\
	||if(not(istrue(isequal(pref_show_snippets,(never)))))||||define||icon_align||center||||endif||\
||ifdef||_note_not_yet_||\
	  <td class="mi ||iftrue(h_note)||note_inlist||endif|| " valign="||icon_align||">\
||else||\
# 	  Floating top-left checkbox
	  <td class="mi" valign="||icon_align||">\
||endif||\
	  <div class="wide_itm"><div class="\
	||iftrue(h_deferred)||\
	 ||iftrue(h_returned)|| star_blue||else|| deferred||endif||\
	||endif||\
 	 ||iftrue(h_flagged)|| star_sel||endif|| x_replied\
		"></div>\
	  </div>\
	</td>\
||endif||\
#	  Bold "from" line
  	  <td class="mi" style="padding:5px; padding-left:3px;">\
\
\
||if(not(istrue(widenew_disable)))||\
	  <div class="wide_icons sw_checkbox_outer">\
	||if(not(istrue(nonselect_row)))||\
		<input class="ws_checkbox" type="checkbox" id="sel_||msg_id||" \
			||if(istrue(multi_row))|| extra_ids="1234,5678" ||endif||/>\
	||endif||\
	  </div>\
||endif||\
\
		<div class="mi" style="padding-top:1px;"><div class="xtrim"><div class="xwide">\
		  <div class="date_etc" style="float:right;">\
		||ifdef||show_fld||\
		  ||if(not(istrue(widenew_disable)))||\
			<a class="wide_fld" title="||web_encode_js(msg_fld)||" style="font-style:italic;">||web_encode_js(msg_fld)||</a> &nbsp; \
		  ||endif||\
		||endif||\
		  	<span class="md wxc" title="||msg_date|| ||msg_time||">||date_basic(msg_xdate)||</span>\
		  </div>\
		  <div class="infoicons" style="margin-right:10px;">\
			  ||ifdef||show_att||\
				||if(not(blank(msg_secure)))||<div class="msgline_lock_||msg_secure|| as"></div>||endif||\
				||if(greater_than(msg_attach,0))||<div class="msgline_clip as"></div>||endif||\
				||if(equal(msg_priority,(high)))||<div class="msgline_high as"></div>||endif||\
				||if(equal(msg_priority,(low)))||<div class="msgline_low as"></div>||endif||\
			  ||endif||\
		  </div>\
	||if(or(equal(fld_type,2),equal(fld_type,3)))||\
		  <a class="wide_to better_wide" style="font-size:1.1em;" title="||web_encode_js(show_rcpts(h_to))||">||web_encode_js(show_rcpts_2(h_to))||</a>\
	||else||\
		  <a class="wide_to better_wide" style="font-size:1.1em;" title="||web_encode_js(show_rcpts(h_from))||">||web_encode_js(show_rcpts_2(h_from))||</a>\
	||endif||\
		</div></div></div>\
#	  Non bold subject line
		<div class="mi" style="padding-top:1px;"><div class="x_trim"><div class="x_wide">\
		    <div style="float:left;">\
			  ||iftrue(pref_devt_mode)||\
				<div class="ar asl"><div class="at"><div class="au"><div class="av">||msg_id||</div></div></div></div>\
			  ||endif||\
		    </div>\
			<div class="date_etc" style="float:right;">\
		 	 <span class="wxc">||bytes_basic(msg_size)||</span>\
		 	</div>\
			<div class="xwide" style="padding-top:1px;"><a class="wide_subj">||web_encode_js(web_encode(h_subject))||</a></div>\
		</div></div></div>\
	  ||ifdef||show_from||\
		<div class="mi"><div class="xtrim"><div class="xwide">\
	  	  ||if(or(equal(fld_type,2),equal(fld_type,3)))||\
			<a title="||web_encode_js(show_rcpts(h_from))||">||web_encode_js(show_rcpts_2(h_from))||</a>\
	  	  ||else||\
			<a title="||web_encode_js(show_rcpts(h_to))||">||web_encode_js(show_rcpts_2(h_to))||</a>\
	  	  ||endif||\
		</div></div><br>\
	  ||endif||\
#	  Comment line		
		<div class="mi">\
	  	||if(and(istrue(h_deferred),not(istrue(h_returned))))||\
			<div class="snippet_outer_wide" style="height:14px;"><span class="snippet">$$st_deferred_until$$ ||date_full(msg_xdefer)||</span></div>\
		||else||\
		  ||iftrue(show_snippets)||\
			<div class="snippet_outer_wide" style="height:||mul(pref_snippet_lines,14)||px;"><span class="snippet">||web_encode_js(web_encode(h_snippet))||</span></div>\
		  ||endif||\
		||endif||\
		</div>\
\
\
# 	  Extras		
	  	<div class="mi"><div class="xtrim"><div class="xwide">\
		  <div class="labels" style="float:right;">\
		  ||begin_list_msg_labels||\
			<div class="ar as" label_id="||web_encode_js(label_name)||"><div class="at" style="background-color: ||label_bg||; border-color: ||label_bdr||;"><div class="au" style="border-color:||label_bdr||;"><div class="av" style="color: ||label_col||;">||web_encode_js(label_name)||</div></div></div></div>\
		  ||end_list_msg_labels||\
		</div>\
		<div class="comment">\
		  ||if(not(blank(h_comment)))||\
			<div class="ar asl"><div class="at" style="background-color: #EAEA1B; border-color: #EAEA1B;"><div class="au" style="border-color:#EAEA1B"><div class="av">||web_encode_js(h_comment)||</div></div></div></div>\
		  ||endif||\
		</div>\
	||ifdef||show_fld||\
	  ||iftrue(widenew_disable))||\
		<a class="wide_fld" title="||web_encode_js(msg_fld)||" style="font-style:italic;">||web_encode_js(msg_fld)||</a>\
	  ||endif||\
	||endif||\
		</div>\
\
\
		</div></div>\
	</td>\
	  </tr>\
	||endif||\
||end_list_messages||\
	','\
		</table>\
	||ifdef||done_some||\
		<div id="msglist_dots" class="widescreen_dots"></div>\
		<div class="msglist_nav">$$st_displayed$$ <span id="msg_navigator_wide"></span></div>\
	||endif||\
	||ifndef||done_some||<div class="nomessages">$$st_info_nomsg_fld$$</div>||endif||</span>',||msgs_count||,||newest_uid||);

update_folder('||fid||','||web_encode_js(search)||');
||ifdef||output_unread_many||\
	update_unread_folders(||tcmd_json_unread_many||);
||endif||

# We have processed the messages so we know what we are displaying :-)
navigator_set( ||json_validate_int(msgs_first)||, ||json_validate_int(plus(minus(msgs_last,msgs_first),1))||, ||json_validate_int(msgs_total)||, '\
	||if(show_pp)||<a href="#" onclick="nav(||show_pp||)"><<</a> ||endif||\
	||if(show_p)||<a href="#" onclick="nav(||show_p||)"><</a> ||endif||\
	||if(not(equal(msgs_total,(0))))||\
		||msgs_first|| - <span id="nav_last">||msgs_last||</span> \
		<span style="font-size:0.9em;">$$st_pages_of$$</span> \
		  ||ifdef||still_downloading|| <b><i title="||$((st_pages_calc_tt),msgs_total)||">||$((st_pages_calc),msgs_total)||</i></b> \
		  ||else|| ||ifdef||search_maxhit|| <b><i title="$$st_pages_max_tt$$"> ||$((st_pages_max),msgs_total)||</i></b> \
		  ||else|| <b><span id="nav_total">||msgs_total||</span></b> \
		  ||endif|| ||endif|| \
	||endif||\
	||if(show_n)||<a href="#" onclick="nav(||show_n||)">></a> ||endif||\
	||if(show_nn)||<a href="#" onclick="nav(||show_nn||)">>></a>||endif||',\
	||json_validate_int(endless_next_id)||, ||json_validate_int(endless_next_t)||);

set_first_message('||first_item||',||json_validate_bool(keep_selection)||,||json_validate_bool(disable_markread)||,||json_validate_bool(no_select)||, U, U, {endless:||json_validate_bool(endless)||});

||ifdef||output_quota||\
	cur_quota({pct:||json_validate_int(quota_pct)||,used:'||kbytes_basic(quota_used)||',limit:'||kbytes_basic(quota_max)||'});
||endif||

||endif||

