Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme updates #3791

Merged
merged 19 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sources/ElkArte/AdminController/ManageRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,10 @@ public function action_registerSettings_display()
theme()->addInlineJavascript('
function checkCoppa()
{
var coppaDisabled = document.getElementById(\'coppaAge\').value == 0;
let coppaDisabled = document.getElementById(\'coppaAge\').value == 0;
document.getElementById(\'coppaType\').disabled = coppaDisabled;

var disableContacts = coppaDisabled || document.getElementById(\'coppaType\').options[document.getElementById(\'coppaType\').selectedIndex].value != 1;
let disableContacts = coppaDisabled || document.getElementById(\'coppaType\').options[document.getElementById(\'coppaType\').selectedIndex].value != 1;
document.getElementById(\'coppaPost\').disabled = disableContacts;
document.getElementById(\'coppaFax\').disabled = disableContacts;
document.getElementById(\'coppaPhone\').disabled = disableContacts;
Expand Down
12 changes: 6 additions & 6 deletions sources/ElkArte/Controller/About.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function action_coppa()

if (isset($this->_req->query->form))
{
$this->handleContactForm();
$this->handleContactForm($member);
}
else
{
Expand All @@ -190,14 +190,14 @@ public function action_coppa()
}

/**
* Handle the contact form for the forum.
* Handle the contact form for member registration.
*
* This method allows for the viewing or downloading of the COPPA form.
* Accessed by action=about;sa=coppa;form;dl;member= and action=about;sa=coppa;form;member=
* This method sets the necessary variables in the global $context for displaying the contact form.
* If the query parameter `dl` is set, the method outputs a file for download, otherwise it shows the contact form template.
*
* @return void
* @param array $member The member data from getBasicMemberData())
*/
private function handleContactForm()
private function handleContactForm($member)
{
global $context, $modSettings, $txt;

Expand Down
2 changes: 2 additions & 0 deletions sources/ElkArte/Controller/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ public function action_vote()
if (!empty($row['change_vote']) && $this->user->is_guest === false && empty($this->_req->post->options))
{
checkSession('request');

// Find out what they voted for before.
$pollOptions = determineVote($this->user->id, $row['id_poll']);

// Just skip it if they had voted for nothing before.
if (!empty($pollOptions))
{
Expand Down
9 changes: 6 additions & 3 deletions sources/ElkArte/Languages/ManageThemes/English.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

$txt['show_group_key'] = 'Show group key on board index.';
$txt['additional_options_collapsible'] = 'Enable collapsible additional post options.';
$txt['show_keyinfo_above'] = 'Show key information (Reply#, Date) above post.';
$txt['who_display_viewing'] = 'Show who is viewing the board index and posts:';
$txt['who_display_viewing_off'] = 'Don\'t show';
$txt['who_display_viewing_numbers'] = 'Show only numbers';
Expand Down Expand Up @@ -136,6 +137,8 @@
$txt['themeadmin_themelist_link'] = 'Show the list of installed themes';

// Strings for the variants
$txt['variant_light'] = 'ElkArte Light';
$txt['variant_besocial'] = 'ElkArte Be Social!';
$txt['variant_dark'] = 'ElkArte Darktanion';
$txt['variant_light'] = 'Fern Green';
$txt['variant_besocial'] = 'Be-Social!';
$txt['variant_dark'] = 'Darktanion';
$txt['variant_blue'] = 'Manic Blue';
$txt['variant_gold'] = 'Harvest Gold';
27 changes: 27 additions & 0 deletions sources/ElkArte/Mentions/MentionType/Event/Watchedboard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* Handles mentions of likes
*
* @package ElkArte Forum
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
*
* @version 2.0 dev
*
*/

namespace ElkArte\Mentions\MentionType\Event;

use ElkArte\Mentions\MentionType\AbstractEventBoardAccess;

/**
* Class WatchedBoard
*
* Handles viewing of watched topics/board mentions only, email is done separately
*/
class Watchedboard extends AbstractEventBoardAccess
{
/** {@inheritDoc} */
protected static $_type = 'watchedboard';
}
77 changes: 77 additions & 0 deletions sources/ElkArte/Mentions/MentionType/Notification/Watchedboard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

/**
* Handles mentioning for watched topics with new posts.
*
* @package ElkArte Forum
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
*
* @version 2.0 dev
*
*/

namespace ElkArte\Mentions\MentionType\Notification;

use ElkArte\Mentions\MentionType\AbstractNotificationMessage;

/**
* Class WatchedBoard
*
* Handles notifying of members whose watched topics have received new posts
*
*/
class Watchedboard extends AbstractNotificationMessage
{
/** {@inheritDoc} */
protected static $_type = 'watchedboard';

/**
* {@inheritDoc}
*/
public function getNotificationBody($lang_data, $members)
{
// Email is handled elsewhere, this is only for on-site mentions
return $this->_getNotificationStrings('', [
'subject' => static::$_type,
'body' => static::$_type,
], $members, $this->_task);
}

/**
* We only use the mentions interface to allow on-site mention for new topics on watched boards
* Email and digests are handled in a separate process due to all the complications
*/
public static function isNotAllowed($method)
{
// Don't let watched be allowed to use email, that is handled by PostNotificaions
if (in_array($method, ['email', 'emaildaily', 'emailweekly']))
{
return true;
}

return false;
}

/**
* There is no interface for this, its always available as an on-site mention and members set
* from profile options notifications
*
* @return true
*/
public static function hasHiddenInterface()
{
return true;
}

/**
* Only called when hasHiddenInterface is true. Returns the application settings as if
* they had been selected in the ACP notifications area
*
* @return array Returns an array containing the settings.
*/
public static function getSettings()
{
return ['enable' => 1, 'notification' => 1, 'default' => [0 => 'notification']];
}
}
5 changes: 5 additions & 0 deletions sources/ElkArte/MetadataIntegrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ public function getLikeCount()
global $context;

$total = 0;
if (empty($context['likes']))
{
return $total;
}

foreach($context['likes'] as $item) {
$total += $item['count'];
}
Expand Down
7 changes: 5 additions & 2 deletions sources/subs/Poll.subs.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ function increaseGuestVote($id_poll)
function determineVote($id_member, $id_poll)
{
$db = database();
$pollOptions = array();
$pollOptions = [];

$db->fetchQuery('
SELECT
Expand All @@ -728,7 +728,10 @@ function determineVote($id_member, $id_poll)
)
)->fetch_callback(
function ($row) use (&$pollOptions) {
$pollOptions[] = $row[0];
if (isset($row['id_choice']))
{
$pollOptions[] = $row['id_choice'];
}
}
);

Expand Down
4 changes: 2 additions & 2 deletions themes/default/Admin.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,11 @@ function template_show_settings()
{
if (empty($config_var['multiple']))
{
$selected = $option[0] === $config_var['value'];
$selected = $option[0] == $config_var['value'];
}
else
{
$selected = in_array($option[0], $config_var['value'], true);
$selected = in_array($option[0], $config_var['value']);
}

echo '
Expand Down
104 changes: 62 additions & 42 deletions themes/default/Display.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,65 +133,42 @@ function template_messages()
$ignoring = false;
}

// Show the message anchor and a "new" anchor if this message is new.
// Show the message anchor and a "new" separator if this message is the first new.
if (($message['id'] != $context['first_message']) && $message['first_new'])
{
echo '
<a id="new">&nbsp;</a>
<hr class="new_post_separator" />';
}

echo '
<article class="post_wrapper forumposts', $message['classes'], $message['approved'] ? '' : ' approvebg', '">', $message['id'] != $context['first_message'] ? '
echo $message['id'] != $context['first_message'] ? '
<a class="post_anchor" id="msg' . $message['id'] . '"></a>' : '';

echo '
<article class="post_wrapper forumposts', $message['classes'], $message['approved'] ? '' : ' approvebg', '">';

if (!empty($settings['show_keyinfo_above']))
{
template_keyinfo($message, $ignoring, true);
}

// Showing the sidebar poster area?
if (empty($options['hide_poster_area']))
{
echo '
<aside>
<aside class="poster">
<ul class="poster no_js">', template_build_poster_div($message, $ignoring), '</ul>
</aside>';
}

echo '
<div class="postarea', empty($options['hide_poster_area']) ? '' : '2', '">
<header class="keyinfo">
', (empty($options['hide_poster_area']) ? '' : '<ul class="poster poster2">' . template_build_poster_div($message, $ignoring) . '</ul>');
<div class="postarea', empty($options['hide_poster_area']) ? '' : '2', '">';

if (!empty($context['follow_ups'][$message['id']]))
if (empty($settings['show_keyinfo_above']))
{
echo '
<ul class="quickbuttons follow_ups no_js">
<li class="listlevel1 subsections" aria-haspopup="true">
<a class="linklevel1">', $txt['follow_ups'], '</a>
<ul class="menulevel2">';

foreach ($context['follow_ups'][$message['id']] as $follow_up)
{
echo '
<li class="listlevel2">
<a class="linklevel2" href="', getUrl('topic', ['topic' => $follow_up['follow_up'], 'start' => '0', 'subject' => $follow_up['subject']]), '">', $follow_up['subject'], '</a>
</li>';
}

echo '
</ul>
</li>
</ul>';
template_keyinfo($message, $ignoring);
}

echo '
<h2 id="post_subject_', $message['id'], '" class="post_subject">', $message['subject'], '</h2>
<span id="messageicon_', $message['id'], '" class="messageicon', ($message['icon_url'] !== $settings['images_url'] . '/post/xx.png') ? '"' : ' hide"', '>
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</span>
<h3 id="info_', $message['id'], '">', empty($message['counter']) ? '' : '
<a href="' . $message['href'] . '" rel="nofollow">' . sprintf($txt['reply_number'], $message['counter']) . '</a> &ndash; ', $message['html_time'], '
</h3>
<div id="msg_', $message['id'], '_quick_mod"', $ignoring ? ' class="hide"' : '', '></div>
</header>';

// Ignoring this user? Hide the post.
if ($ignoring)
{
Expand All @@ -213,10 +190,10 @@ function template_messages()

// Show the post itself, finally!
echo '
<section id="msg_', $message['id'], '" data-msgid="',$message['id'], '" class="messageContent', $ignoring ? ' hide"' : '"', '>',
<section id="msg_', $message['id'], '" data-msgid="', $message['id'], '" class="messageContent', $ignoring ? ' hide' : '', !empty($settings['show_keyinfo_above']) ? ' above' : '', '">',
$message['body'], '
</section>
<footer>';
<footer class="post_footer">';

// This is the floating Quick Quote button.
echo '
Expand Down Expand Up @@ -323,6 +300,49 @@ function template_messages()
}
}

function template_keyinfo($message, $ignoring, $above = false)
{
global $context, $settings, $options, $txt;

echo '
<header class="keyinfo', ($above ? ' above' : ''), '">
', (empty($options['hide_poster_area']) ? '' : '<ul class="poster poster2">' . template_build_poster_div($message, $ignoring) . '</ul>');

if (!empty($context['follow_ups'][$message['id']]))
{
echo '
<ul class="quickbuttons follow_ups no_js">
<li class="listlevel1 subsections" aria-haspopup="true">
<a class="linklevel1">', $txt['follow_ups'], '</a>
<ul class="menulevel2">';

foreach ($context['follow_ups'][$message['id']] as $follow_up)
{
echo '
<li class="listlevel2">
<a class="linklevel2" href="', getUrl('topic', ['topic' => $follow_up['follow_up'], 'start' => '0', 'subject' => $follow_up['subject']]), '">', $follow_up['subject'], '</a>
</li>';
}

echo '
</ul>
</li>
</ul>';
}

echo '
<h2 id="post_subject_', $message['id'], '" class="post_subject">', $message['subject'], '</h2>
<span id="messageicon_', $message['id'], '" class="messageicon', ($message['icon_url'] !== $settings['images_url'] . '/post/xx.png') ? '"' : ' hide"', '>
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</span>
<h3 id="info_', $message['id'], '">', empty($message['counter']) ? '' : '
<a href="' . $message['href'] . '" rel="nofollow">' . sprintf($txt['reply_number'], $message['counter']) . '</a> &ndash; ', $message['html_time'], '
</h3>
<div id="msg_', $message['id'], '_quick_mod"', $ignoring ? ' class="hide"' : '', '></div>
</header>';

}

/**
* Closes the topic information, descriptions, etc. divs and forms
*/
Expand Down Expand Up @@ -596,7 +616,7 @@ function template_display_poll_above()
{
echo '
', $option['bar_ndt'], '
<span class="righttext poll-percent">[ ', $option['votes'], ' ] (', $option['percent'], '%)</span>';
<span class="righttext poll-percent', !empty($option['votes']) ? ' voted"' : '"', '>[ ', $option['votes'], ' ] (', $option['percent'], '%)</span>';
}

echo '
Expand All @@ -609,7 +629,7 @@ function template_display_poll_above()
if ($context['allow_poll_view'])
{
echo '
<p>
<p class="pollvote">
<strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '
</p>';
}
Expand Down Expand Up @@ -639,7 +659,7 @@ function template_display_poll_above()

echo '
</ul>
<div class="submitbutton">
<div class="pollvote">
<input type="submit" value="', $txt['poll_vote'], '" class="left_submit" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</div>
Expand Down
Loading
Loading