widget.naml

<macro name="sidebar_widget" requires="node_page,servlet">
	<n.actions_widget/>
	<n.people_widget/>
	<n.subscribe_widget/>
	<n.categories_widget/>
	<n.archives_widget/>
</macro>

<macro name="people_widget">
	<n.put_in_head.>
		<style type="text/css">
			a.people-small-link {
				float:right;
				font-size:80%;
				padding:.1em .3em;
			}
		</style>
	</n.put_in_head.>
	<n.site_users. length="50">
		<n.filter_by.current_user.can_be_displayed_in.page_node/>
		<n.if.has_more_elements n="2">
			<then>
				<n.widget.>
					<h2 class="sidebar-section shaded-bg-color">
						<n.page_node.people_link text="[t]All Users[/t]" class="people-small-link"/>
						<t>People</t>
					</h2>
					<div id="recent-posters">
						<n.sub_list. start="0" length="12">
							<n.people_widget_table/>
						</n.sub_list.>
					</div>
				</n.widget.>
			</then>
		</n.if.has_more_elements>
	</n.site_users.>
</macro>

<macro name="people_widget_table" requires="user_list">
	<table style="width:100%">
		<n.loop.>
			<tr>
				<td><n.current_user.avatar size="small"/></td>
				<n.if.next_user>
					<then><td><n.current_user.avatar size="small"/></td></then>
				</n.if.next_user>
				<n.if.next_user>
					<then><td><n.current_user.avatar size="small"/></td></then>
				</n.if.next_user>
				<n.if.next_user>
					<then><td><n.current_user.avatar size="small"/></td></then>
				</n.if.next_user>
			</tr>
		</n.loop.>
	</table>
</macro>

<macro name="actions_widget" requires="node_page">
	<n.widget.>
		<table class="actions" style="border-collapse:collapse;width:100%">
			<n.new_topic_action_row/>
			<n.app_dropdown_action_row/>
			<n.app_views_action_row/>
			<n.app_feeds_action_row/>
		</table>
	</n.widget.>
</macro>

<macro name="new_topic_action_row" requires="node_page">
	<tr>
		<td style="width:20px">
			<img src="/images/icon_post_message.png" class="image16" border="0"/>
		</td>
		<td class="nowrap" style="padding-left:.2em">
			<n.page_node.new_topic_link
				text="[t]New Post[/t]"
				title="[t]Post new message in [t.location.page_node.subject/][/t]"
			/>
		</td>
	</tr>
</macro>

<macro name="app_dropdown_action_row" requires="node_page">
	<tr>
		<td style="width:20px;padding-top:.5em">
			<img src="/images/gear.png" class="image16" border="0" />
		</td>
		<td class="nowrap" style="padding:.5em 0 0 .2em">
			<n.page_node.app_dropdown/>
		</td>
	</tr>
</macro>

<macro name="app_views_action_row" requires="node_page">
	<tr>
		<td style="width:20px;padding-top:.5em">
			<img src="/images/eye.png" class="image16"/>
		</td>
		<td class="nowrap" style="padding:.5em 0 0 .2em">
			<n.page_node.views show_text="true"/>
		</td>
	</tr>
</macro>

<macro name="app_feeds_action_row" requires="node_page">
	<tr>
		<td style="width:20px;padding-top:.5em">
			<img src="/images/feeds.png" width="16" height="16" border="0" alt="feeds"/>
		</td>
		<td class="nowrap" style="padding:.5em 0 0 .2em">
			<n.page_node.feeds_link/>
		</td>
	</tr>
</macro>

<macro name="subscribe_widget">
	<n.widget.>
		<div id="subscribe-widget" class="invisible">
			<h2 class="sidebar-section shaded-bg-color"><t>Subscribe via email</t></h2>
			<ul id="subscribe-widget-form" class="sidebar-section">
				<n.form. macro="subscribe">
					<input type="hidden" name="node" value="[n.page_node.id/]"/>
					<input type="hidden" name="action" value="send-anonymous"/>
					<input type="hidden" name="subscription_to" value="CHILDREN"/>
					<table>
						<tr>
							<td><b><t>Email</t></b></td>
							<td><input type="text" size="25" maxlength="80" name="email"/></td>
						</tr>
						<tr>
							<td></td>
							<td><input type="submit" value="[t]Subscribe[/t]" style="margin-top:.5em"/></td>
						</tr>
					</table>
				</n.form.>
			</ul>
		</div>
		<script type="text/javascript">
			if (!Nabble.userId)
				Nabble.get('subscribe-widget').style.display = 'block';
		</script>
	</n.widget.>
</macro>

<macro name="categories_widget">
	<n.widget.>
		<n.if.page_node.has_subapps>
			<then>
				<h2 class="sidebar-section shaded-bg-color"><t>Subcategories</t></h2>
				<ul class="sidebar-section">
					<n.page_node.subapps_list.loop.>
						<li class="medium-border-color"><n.current_node.node_link.url/></li>
					</n.page_node.subapps_list.loop.>
				</ul>
				<n.separator/>
			</then>
		</n.if.page_node.has_subapps>
	</n.widget.>
</macro>

<macro name="archives_widget" requires="node_page,servlet">
	<n.widget.>
		<h2 class="sidebar-section shaded-bg-color"><t>Archives</t></h2>
		<ul class="sidebar-section">
			<n.page_node.monthly_archives.>
				<li class="medium-border-color">
					<a href="[n.page_node.path/]"><t>All</t></a>
					<span class="weak-color">(<n.total/>)</span>
				</li>

				<n.year_list.loop.>
					<li class="medium-border-color">
						<div class="year bold">
							<span>&#9656;</span>
							<n.current_year.year/>
						</div>
						<div style="margin:.3em 0 .3em 1em; display:none">
							<n.current_year.month_list.loop.>
								<n.set_var. name="year-month"><n.current_month.year/><n.current_month.month/></n.set_var.>
								<n.set_var. name="class">
									<n.if.equal value1="[n.var name='year-month'/]" value2="[n.app_date/]">
										<then>highlight</then>
									</n.if.equal>
								</n.set_var.>
								<n.set_var. name="archive-url">
									<n.page_node.app_path_by_date date="[n.var name='year-month'/]"/>
								</n.set_var.>
								<div class="[n.var name='class'/]" style="margin:.2em 0; padding: .2em .3em">
									<a href="[n.var name='archive-url'/]" rel="nofollow"><n.current_month.archive_text/></a>
									<span class="weak-color">(<n.current_month.count/>)</span>
								</div>
							</n.current_year.month_list.loop.>
						</div>
					</li>
				</n.year_list.loop.>
			</n.page_node.monthly_archives.>
		</ul>
		<script type="text/javascript">
			$(document).ready(function() {
				function collapse(e) {
					$(e).children().first().html('&#9656;');
					$(e).next().slideUp();
				};
				function expand(e) {
					$(e).children().first().html('&#9662;');
					$(e).next().slideDown();
				};
				var $years = $('.year');
				$years.css('cursor', 'pointer');
				var expanded = false;
				$years.each(function() {
					var isOpen = $('div.highlight', $(this).next()).size() > 0;
					if (isOpen) {
						expand(this);
						expanded = true;
					}
					$(this).click(function() {
						var isOpen = $(this).next().is(':visible');
						if (isOpen)
							collapse(this);
						else
							expand(this);
					});
				});
				if (!expanded) {
					expand($years.eq(0).get());
				}
			});
		</script>
	</n.widget.>
</macro>

<macro name="archive_text" requires="month_row">
	<n.if.equal value1="[n.month/]" value2="01"><then><t>January</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="02"><then><t>February</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="03"><then><t>March</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="04"><then><t>April</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="05"><then><t>May</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="06"><then><t>June</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="07"><then><t>July</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="08"><then><t>August</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="09"><then><t>September</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="10"><then><t>October</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="11"><then><t>November</t></then></n.if.equal>
	<n.if.equal value1="[n.month/]" value2="12"><then><t>December</t></then></n.if.equal>
</macro>