<?php

/**
 *
 * @copyright  2016-2017 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
?>
<?php extract($errors); ?>
<h3<?php if ($thread_title): ?> title="<?php echo $thread_id; ?>"<?php endif; ?>><?php echo htmlspecialchars($thread_title ? $thread_title : $thread_id , ENT_COMPAT, 'UTF-8'); ?></h3>
<form class="compact" action="" method="post">
<input name="clang" type="hidden" value="<?php echo $clang; ?>" />
<p>
<?php echo $inlanguages; ?>
</p>
<p>
<input class="submit submit_add" id="node_create" name="node_create" type="submit" value="Add" />
campaign
<input id="new_node_title" name="new_node_title" type="text" size="50" maxlength="100" value="<?php echo htmlspecialchars($new_node_title, ENT_COMPAT, 'UTF-8'); ?>" title="Title" onkeypress="return focusonenter(event, 'new_node_number')"/>
<span class="nowrap">
#
<input id="new_node_number" name="new_node_number" type="text" size="2" maxlength="3" value="<?php echo htmlspecialchars($new_node_number, ENT_COMPAT, 'UTF-8'); ?>" title="Number" onkeypress="return submitonenter(event, 'node_create')"/>
</span>
</p>
<?php if ($thread_contents): ?>
<div id="threadcontent">
<fieldset class="block">
<legend>Titles</legend>
<table cellpadding="2" cellspacing="0">
<tbody>
<?php
$i=1;
$maxlen=strlen(count($thread_contents))+1;
foreach ($thread_contents as $c) {
	extract($c);	/* pos, node_id node_title, node_url, node_number, node_ignored */
	$node_url .= '?' . 'clang=' . $clang;
?>
<tr>
<td><input name="p[<?php echo $i; ?>]" type="text" size="2" maxlength="<?php echo $maxlen; ?>" value="<?php echo $pos; ?>" /></td>
<td><a href="<?php echo $node_url; ?>" title="<?php echo $node_id; ?>"><?php echo $node_title ? htmlspecialchars($node_title, ENT_COMPAT, 'UTF-8') : $node_id; ?></a></td>
</tr>
<?php
	$i++;
}
?>
</tbody>
</table>
</fieldset>
<p>
<input class="submit submit_sort" id="thread_reorder" name="thread_reorder" type="submit" value="Sort" />
list or
<input class="submit submit_copy" id="node_copy" name="node_copy" type="submit" value="Copy" />
or
<input class="submit submit_delete" id="node_delete" name="node_delete" type="submit" value="Delete" />
campaign
<span class="nowrap">
#
<input id="old_node_number" name="old_node_number" type="text" size="2" maxlength="3" value="<?php echo htmlspecialchars($old_node_number, ENT_COMPAT, 'UTF-8'); ?>" title="Number" onkeypress="return submitonenter(event, 'node_delete')"/>
</span>
<?php if ($confirm_delete_node): ?>
<input class="submit submit_confirm" id="node_confirmdelete" name="node_confirmdelete" type="submit" value="Confirm" />
<?php endif; ?>
</p>
</div>
<?php endif; ?>
</form>
<?php
$focus=false;
if ($missing_new_node_title or $bad_new_node_title) {
	$focus='#new_node_title';
}
else if ($bad_new_node_number) {
	$focus='#new_node_number';
}
else if ($missing_old_node_number or $bad_old_node_number) {
	$focus='#old_node_number';
}
else if ($confirm_delete_node) {
	$focus='#old_node_number';
}
?>
<?php if ($focus): ?>
<?php head('javascript', 'jquery.scrollTo', 'screen'); ?>
<script type="text/javascript">
$(function() {$('<?php echo $focus; ?>').focus(); $.scrollTo('<?php echo $focus; ?>', {offset: -200}); });
</script>
<?php endif; ?>
