News Post Abstract List-friendly news article
[show modes: view edit info]

[begin mode view]
[
	page("abbr", $_id, list("full"));

	$q = query("children", 25, "id ASC, title", "parent", $_id);
	$qc = query_count($q);
	if($qc != "0") {<h2>Comments</h2>[query_view("view", $q)]};
]
[end mode view]

[begin mode bare]
[$_body]
[end mode bare]

[begin mode abbr2]
<li><a href="/?[$_title]">[$_title]</a> ([$_subtitle])
[$children = children("abbr", $_id);
iif($children, echo("<ol>" & $children & "</ol>"), "");]
</li>
[end mode abbr2]

[begin mode abbr3]
<li><a href="/?[$_title]" title="[$_subtitle]">[$_title]</a></li>
[end mode abbr3]

[begin mode delete]
[$n = delete_page($_id);
children("delete", $_id);
if($n == "1") {
	<p><b>[$_title]</b> has been removed from 
	<b>[get_title($_parent)]</b>.</p>
} else {
	<p><b>[$_title]</b> could not be removed from 
	<b>[get_title($_parent)]</b> by you ([$_viewer.name]). If 
	you feel that should be able to do so, now might be a good 
	time to	<a href="mailto:hexadecima@gmail.com">complain and/or 
	whine</a>.</p>
}]
<p><a href="/?id=[$_parent]">Return to [get_title($_parent)]</a></p>
[end mode delete]

[begin mode abbr]
[msg_start({position: relative; padding-bottom: 30px;})]
[
if($_args[0] != "no_icon") {

<div style="font-size: 70%; margin: 0px; border: 1px solid rgba(0,0,0,0.15); padding: 4px; margin-right: 15px; float: left; text-align: center; background: rgba(0,0,0,0.05); box-shadow: 1px 1px 3px rgba(0,0,0,0.1);">
	[
	if($_args[0] == "inherit") {[
		if(has_mode("icon", $_parent)) {[
			page("icon", $_parent);
		]} else if($_owner.profile_id != 0) {[
			page("icon", $_owner.profile_id);
		]};
	]} else if($_owner.profile_id != 0) {
		[page("icon", $_owner.profile_id);]
	};
	]
[
if(can_direct() + can_edit()) {<p style="margin: 0px; padding: 0px; margin-top: 5px;">};
if(can_edit()) {<a href="/?id=[$_id]&mode=edit">edit</a>[if(can_direct()) { · }]};
if(can_direct()) {<a href="/?id=[$_id]&mode=delete">delete</a>};
if(can_direct() + can_edit()) {</p>};
]
</div>
} else {[
	if(can_edit() + can_direct()) {<p style="display: block; float: right; margin: 0px; font-size: 80%;">};
	if(can_edit()) {<a href="/?id=[$_id]&mode=edit">edit</a>[if(can_direct()) { · }]};
	if(can_direct()) {<a href="/?id=[$_id]&mode=delete">delete</a>};
	if(can_edit() + can_direct()) {</p>};
]};
]

<a href="?id=[$_id]"><b>[$_title]</b></a><br>
<div style="width: auto !important; padding: 0 !important;">
[

$b = replace($_body, "[snip]", "");
$d = strpos($_body, "[snip]");

if($_args[0] != "full") {[
	if($d != "-1") {[
		_wiki_format({[substr($b, 0, $d)] ["["]#[$_id]["|(…)]"]});
	]} else {[
		_wiki_format($b);
	]};
]} else {[
	_wiki_format($b);
]};

]
</div>

<span class="caption newstag" style="font-size: 80%; bottom: 8px; left: 8px; position: absolute;">
<a href="/?id=[$_parent]">[if(get_template($_parent) != 8) get_title($_parent) else page("blog_title", $_parent)]</a>
</span>

<span class="caption newstag" style="font-size: 80%; bottom: 8px; right: 8px; position: absolute;">

[
$q = query({children_[$_id]}, 0, "id", "parent", $_id);

if(can_comment())
  {<a href="?id=[$_id]&mode=comment">comment</a> &middot; };

$qc = query_count($q);

if($d == "-1") {[
	$bleft = 0;
]} else {[
	$bleft = (len($b) - $d);
]};

if($_args[0] != "full") {[
	if($bleft != 0) {[
		if($qc != "0") {
			<a href="/?id=[$_id]">read more
			([$qc] comment[iif($qc != 1, "s", "")], [$bleft] bytes)</a> &middot; } else {<a href="/?id=[$_id]">read more
			([$bleft] bytes)</a> &middot; };
	]} else {[
		if($qc != "0") {<a href="/?id=[$_id]">read more
		([$qc] comment[iif($qc != 1, "s", "")])</a> &middot; };
	]};
]};
]

[if(soft_age[$_subtitle] == "") {
	[soft_age($_date)] ago
} else {
	[soft_age($_subtitle)] ago
};
]

</span>

<div style="clear: both;"></div>

[msg_end()]
[end mode abbr]

[begin mode table]
<tr><td style="width: 120px !important">
    [substr($_subtitle, 5, 11)]
</td><td style="width: 240px !important">
    <a href="/?[$_title]">[$_title]</a>
</td></tr>
[end mode table]

[begin mode info]
<table>
<tr><th>Title:</th><td>[info_display($_title)]</td></tr>
<tr><th>Date (subtitle):</th><td>[info_display($_subtitle)]</td></tr>
<tr><th>Parent:</th><td>[$_parent]</td></tr>
<tr><th>Permissions:</th><td>[$_permissions]</td></tr>
<tr><th>Author:</th><td>[$_author]</td></tr>
<tr><th>Group:</th><td>[$_group]</td></tr>
<tr><th>ID:</th><td>[$_id]</td></tr>
<tr><th>Template:</th><td>[$_template]</td></tr>
<tr><th>Body:</th><td>[info_display($_body)]</td></tr>
<tr><th>Body Alternate:</th><td>[replace(info_display($_body), "&amp;", "&")]</td></tr>
</table>
[end mode info]

[begin mode edit]
<form method="post" action="/">
<input type="hidden" name="id" value="[$_id]">
<input type="hidden" name="mode" value="submit">
<table>
<tr><th>Title:</th><td><input type="text" class="textbox" name="title" value="[edit_display($_title)]" style="width: 100%"></td></tr>
[if($_subtitle == "") $_subtitle = $_date;]
<tr><th>Category:</th><td><select name="parent">
<option value="[$_parent]" selected>[get_title($_parent)]</option>
[
// index("option", title2id("Galaxy"));
]
</select>
</td></tr>
<tr><th>Body:</th><td><textarea class="textbox" name="body" rows="20" cols="70">[edit_display($_body)]</textarea>
<span style="font-size: 80%; display: block;">You may use PP-style wiki formatting here. Type <tt>["[snip]"]</tt> to get an LJ-like cut.</span>
</td></tr>
<tr><td></td><td>
<input name="submitButton" class="submit" type="submit" value="Submit"> <i>your permissions</i>: [summarize_permissions($_viewer.permissions)]</td></tr></table>
</form>
[end mode edit]

[begin mode submit]
[
	$_title = $_params.title;
	$_parent = $_params.parent;
	$_body = $_params.body;
]
<h2>It was submitted.</h2>
<a href="/?[$_title]">Return to it.</a>
[end mode submit]

[begin mode comment]
	[_post_comment($_id)]
[end mode comment]

[begin mode comment_submit]
    [$title = {Comment on [$_title] at [now()] by [$_viewer.ip]};
	$e = new_page($title, $_id);
	if($e) {[
	    set_body($e, $_params.body);
	    set_template($e, title2id("Generic Comment"));
            set_permissions($e, "cadrec--r-c-dr-c--r-");
            msg_start();]
            Commented successfully!<br>
            <a href="/?id=[$_id]">Return to the article.</a>
            [msg_end();
        ]} else {[
            msg_start();]
            Couldn't comment.<br>
            Maybe you don't have permissions?<br>
            Are you logged in?<br>
            <a href="/?id=[$_id]">Return to the article.</a>
            [msg_end();
        ]};
    ]
[end mode comment_submit]