Browse Source

Add ['overboard_post_form'] to allow overboard post forms. Adjustments to ukko theme to support this

pull/40/head
Benjamin Southall 7 years ago
parent
commit
a16122329f
  1. 3
      inc/config.php
  2. 10
      templates/post_form.html
  3. 11
      templates/themes/ukko/theme.php
  4. 2
      templates/themes/ukko/ukko.js

3
inc/config.php

@ -1847,3 +1847,6 @@
// Allowed HTML tags in ?/edit_pages. // Allowed HTML tags in ?/edit_pages.
$config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr'; $config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr';
// Enable posting in overboard
$config['overboard_post_form'] = false;

10
templates/post_form.html

@ -2,7 +2,9 @@
{{ antibot.html() }} {{ antibot.html() }}
{% if id %}<input type="hidden" name="thread" value="{{ id }}">{% endif %} {% if id %}<input type="hidden" name="thread" value="{{ id }}">{% endif %}
{{ antibot.html() }} {{ antibot.html() }}
{% if board.uri not in config.overboards|keys %}
<input type="hidden" name="board" value="{{ board.uri }}"> <input type="hidden" name="board" value="{{ board.uri }}">
{% endif %}
{{ antibot.html() }} {{ antibot.html() }}
{% if current_page %} {% if current_page %}
<input type="hidden" name="page" value="{{ current_page }}"> <input type="hidden" name="page" value="{{ current_page }}">
@ -56,6 +58,14 @@
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if board.uri in config.overboards|keys %}
<tr><th>Board</th><td>
<select style="float: left; width: 185px;" name="board">
{% for myboard in boards %}
<option value="{{ myboard['uri'] }}">{{ myboard['uri'] }} ( {{ myboard['title'] }} )</option>
{% endfor %}
</select></td></tr>
{% endif %}
{% if not config.field_disable_comment or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr> {% if not config.field_disable_comment or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>
<th> <th>
{% trans %}Comment{% endtrans %} {% trans %}Comment{% endtrans %}

11
templates/themes/ukko/theme.php

@ -45,11 +45,13 @@
'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit']) 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit'])
); );
$boardsforukko = array();
$query = ''; $query = '';
foreach($boards as &$_board) { foreach($boards as &$_board) {
if(in_array($_board['uri'], explode(' ', $this->settings['exclude']))) if(in_array($_board['uri'], explode(' ', $this->settings['exclude'])))
continue; continue;
$query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL UNION ALL ", $_board['uri'], $_board['uri']); $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL UNION ALL ", $_board['uri'], $_board['uri']);
array_push($boardsforukko,$_board);
} }
$query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query); $query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);
$query = query($query) or error(db_error()); $query = query($query) or error(db_error());
@ -80,8 +82,8 @@
while ($po = $posts->fetch()) { while ($po = $posts->fetch()) {
if ($po['files']) if ($po['files'])
$num_images++; $num_images++;
$post2 = new Post($po, $mod ? '?/' : $config['root'], $mod);
$thread->add(new Post($po, $mod ? '?/' : $config['root'], $mod)); $thread->add($post2);
} }
if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) { if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
@ -140,11 +142,12 @@
return Element('index.html', array( return Element('index.html', array(
'config' => $config, 'config' => $config,
'board' => $board, 'board' => $board,
'no_post_form' => true, 'no_post_form' => $config['overboard_post_form'] ? false : true,
'body' => $body, 'body' => $body,
'mod' => $mod, 'mod' => $mod,
'boardlist' => createBoardlist($mod), 'boardlist' => createBoardlist($mod),
)); 'boards' => $boardsforukko )
);
} }
}; };

2
templates/themes/ukko/ukko.js

@ -84,7 +84,7 @@ $(document).ready(function() {
$(data).find('div[id*="thread_"]').each(function() { $(data).find('div[id*="thread_"]').each(function() {
var checkout = $(this).attr('id').replace('thread_', ''); var checkout = $(this).attr('id').replace('thread_', '');
if ($('div#thread_' + checkout + '[data-board="' + overflow[0].board + '"]').length == 0) { if ($('div#thread_' + checkout + '[data-board="' + overflow[0].board + '"]').length == 0) {
$('form[name="postcontrols"]').prepend($(this).css('display', 'none').attr("data-cached", "yes").attr('data-board', overflow[0].board)); $('form[name="postcontrols"]').prepend($(this).css('display', 'block').attr("data-cached", "yes").attr('data-board', overflow[0].board));
} }
}); });

Loading…
Cancel
Save