Skip to content

Commit

Permalink
Merge pull request #194 from JoomJunk/development
Browse files Browse the repository at this point in the history
Merge Update v6.0.2
  • Loading branch information
C-Lodder committed Oct 1, 2015
2 parents dc47a57 + f63a7db commit 9828646
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 63 deletions.
3 changes: 3 additions & 0 deletions changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- -> Removed
! -> Note

Version 6.0.2
+ Added option to hide history

Version 6.0.1
# Fixes to smiley dropdown for Bootstrap 3

Expand Down
1 change: 1 addition & 0 deletions mod_shoutbox/language/de-DE/de-DE.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@ SHOUT_HTML5_NOTIFICATION_LABEL="HTML5 Notifications"
SHOUT_HTML5_NOTIFICATION_DESC="Select whether or not you'd like to use HTML5 notifications when a new shout has been posted. Please note this will not work in Internet Explorer, Edge and some mobile browsers."
SHOUT_NEW_SHOUT_ALERT="New Shout!"
SHOUT_HISTORY="Shoutbox History"
SHOUT_HISTORY_DESC="Select whether or not you'd like to be able to view the shoutbox history"
SHOUT_HISTORY_BUTTON="History"
SHOUT_HISTORY_LOAD_MORE="Load more"
1 change: 1 addition & 0 deletions mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@ SHOUT_HTML5_NOTIFICATION_LABEL="HTML5 Notifications"
SHOUT_HTML5_NOTIFICATION_DESC="Select whether or not you'd like to use HTML5 notifications when a new shout has been posted. Please note this will not work in Internet Explorer, Edge and some mobile browsers."
SHOUT_NEW_SHOUT_ALERT="New Shout!"
SHOUT_HISTORY="Shoutbox History"
SHOUT_HISTORY_DESC="Select whether or not you'd like to be able to view the shoutbox history"
SHOUT_HISTORY_BUTTON="History"
SHOUT_HISTORY_LOAD_MORE="Load more"
1 change: 1 addition & 0 deletions mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,6 @@ SHOUT_HTML5_NOTIFICATION_LABEL="HTML5 Notifications"
SHOUT_HTML5_NOTIFICATION_DESC="Select whether or not you'd like to use HTML5 notifications when a new shout has been posted. Please note this will not work in Internet Explorer, Edge and some mobile browsers."
SHOUT_NEW_SHOUT_ALERT="New Shout!"
SHOUT_HISTORY="Shoutbox History"
SHOUT_HISTORY_DESC="Select whether or not you'd like to be able to view the shoutbox history"
SHOUT_HISTORY_BUTTON="History"
SHOUT_HISTORY_LOAD_MORE="Load more"
1 change: 1 addition & 0 deletions mod_shoutbox/language/nb-NO/nb-NO.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,6 @@ SHOUT_HTML5_NOTIFICATION_LABEL="HTML5 Notifications"
SHOUT_HTML5_NOTIFICATION_DESC="Select whether or not you'd like to use HTML5 notifications when a new shout has been posted. Please note this will not work in Internet Explorer, Edge and some mobile browsers."
SHOUT_NEW_SHOUT_ALERT="New Shout!"
SHOUT_HISTORY="Shoutbox History"
SHOUT_HISTORY_DESC="Select whether or not you'd like to be able to view the shoutbox history"
SHOUT_HISTORY_BUTTON="History"
SHOUT_HISTORY_LOAD_MORE="Load more"
1 change: 1 addition & 0 deletions mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,6 @@ SHOUT_HTML5_NOTIFICATION_LABEL="HTML5 Notifications"
SHOUT_HTML5_NOTIFICATION_DESC="Select whether or not you'd like to use HTML5 notifications when a new shout has been posted. Please note this will not work in Internet Explorer, Edge and some mobile browsers."
SHOUT_NEW_SHOUT_ALERT="New Shout!"
SHOUT_HISTORY="Shoutbox History"
SHOUT_HISTORY_DESC="Select whether or not you'd like to be able to view the shoutbox history"
SHOUT_HISTORY_BUTTON="History"
SHOUT_HISTORY_LOAD_MORE="Load more"
1 change: 1 addition & 0 deletions mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,6 @@ SHOUT_HTML5_NOTIFICATION_LABEL="HTML5 Notifications"
SHOUT_HTML5_NOTIFICATION_DESC="Select whether or not you'd like to use HTML5 notifications when a new shout has been posted. Please note this will not work in Internet Explorer, Edge and some mobile browsers."
SHOUT_NEW_SHOUT_ALERT="New Shout!"
SHOUT_HISTORY="Shoutbox History"
SHOUT_HISTORY_DESC="Select whether or not you'd like to be able to view the shoutbox history"
SHOUT_HISTORY_BUTTON="History"
SHOUT_HISTORY_LOAD_MORE="Load more"
13 changes: 9 additions & 4 deletions mod_shoutbox/media/js/mod_shoutbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ jQuery(document).ready(function($) {
/**
* Submit a shout
*/
JJShoutbox.submitPost = function(name, title, securityType, security, Itemid, instance, ReCaptchaResponse)
JJShoutbox.submitPost = function(name, title, securityType, security, Itemid, instance, ReCaptchaResponse, history)
{
// Assemble some commonly used vars
var textarea = instance.find('#jj_message'),
Expand Down Expand Up @@ -405,7 +405,7 @@ jQuery(document).ready(function($) {
}

// Refresh the output
JJShoutbox.getPosts(title, false, false, Itemid, instance, false)
JJShoutbox.getPosts(title, false, false, Itemid, instance, false, history)
}
else
{
Expand Down Expand Up @@ -445,7 +445,7 @@ jQuery(document).ready(function($) {
* Get the latest shouts
* Play a sound notification if new shouts are shown
*/
JJShoutbox.getPosts = function(title, sound, notifications, Itemid, instance, loggedInUser)
JJShoutbox.getPosts = function(title, sound, notifications, Itemid, instance, loggedInUser, history)
{
// Get the ID of the last shout
var lastID = JJShoutbox.getLastID(instance);
Expand All @@ -472,7 +472,12 @@ jQuery(document).ready(function($) {
{
instance.find('#jjshoutboxoutput').empty().prepend($('<div class="jj-shout-new"></div>'));

var historyButton = '<div class="center-block"><a href="#" id="jj-history-trigger" class="btn btn-primary btn-mini btn-xs uk-button uk-button-primary uk-button-mini">' + Joomla.JText._('SHOUT_HISTORY_BUTTON') + '</a></div>';
var historyButton = '';

if (history == 1)
{
historyButton = '<div class="center-block"><a href="#" id="jj-history-trigger" class="btn btn-primary btn-mini btn-xs uk-button uk-button-primary uk-button-mini">' + Joomla.JText._('SHOUT_HISTORY_BUTTON') + '</a></div>';
}

// Grab the html output and append it to the shoutbox message
instance.find('.jj-shout-new').after(response.data.html + historyButton);
Expand Down
1 change: 1 addition & 0 deletions mod_shoutbox/mod_shoutbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
$messageLength = $params->get('messagelength', '200');
$refresh = $params->get('refresh', 10) * 1000;
$deleteown = $params->get('deleteown', 0);
$history = $params->get('history', 1);
$remainingLength = JText::_('SHOUT_REMAINING');

// Assemble the factory variables needed
Expand Down
6 changes: 5 additions & 1 deletion mod_shoutbox/mod_shoutbox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>http://www.gnu.org/licenses/gpl-3.0.html</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://www.joomjunk.co.uk</authorUrl>
<version>6.0.1</version>
<version>6.0.2</version>
<description>JJSHOUTBOX_DESCRIPTION</description>

<install>
Expand Down Expand Up @@ -109,6 +109,10 @@
<option value="0">JOFF</option>
<option value="1">JON</option>
</field>
<field name="history" type="radio" class="btn-group" default="1" label="SHOUT_HISTORY" description="SHOUT_HISTORY_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>

<fieldset name="styling" label="SHOUT_STYLING">
Expand Down
1 change: 1 addition & 0 deletions mod_shoutbox/sql/mysql/updates/6.0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder file for database changes for version 6.0.2
1 change: 1 addition & 0 deletions mod_shoutbox/sql/postgresql/updates/6.0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder file for database changes for version 6.0.2
125 changes: 67 additions & 58 deletions mod_shoutbox/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,17 @@
{
echo $helper->renderPost($shout);
}
}

if ($history == 1)
{
?>
<div id="jj-history-container" class="center-block">
<a href="#" id="jj-history-trigger" class="btn btn-primary btn-mini btn-xs uk-button uk-button-primary uk-button-mini"><?php echo JText::_('SHOUT_HISTORY_BUTTON'); ?></a>
</div>
<?php
}
?>

<div id="jj-history-container" class="center-block">
<a href="#" id="jj-history-trigger" class="btn btn-primary btn-mini btn-xs uk-button uk-button-primary uk-button-mini"><?php echo JText::_('SHOUT_HISTORY_BUTTON'); ?></a>
</div>
?>
</div>
<div class="jj-shout-error"></div>

Expand Down Expand Up @@ -313,46 +318,15 @@ class="<?php echo $input_txtarea; ?>"
<?php endif; ?>
</div>

<div id="jj-history-modal" class="<?php echo $modal; ?>" tabindex="-1" role="dialog" aria-labelledby="JJ History Modal" aria-hidden="true">
<?php if ($framework == 'uikit') : ?>
<div class="uk-modal-dialog">
<a class="uk-modal-close uk-close"></a>
<div class="uk-modal-header">
<h3><?php echo JText::_('SHOUT_HISTORY'); ?></h3>
</div>
<div id="jj-shout-history" class="uk-overflow-container">
<?php
// Retrieves the shouts from the database
$shouts = $helper->getShouts(0, $number, $dataerror);

// Counts the number of shouts retrieved from the database
$actualnumber = count($shouts);

if ($actualnumber == 0)
{
echo '<div><p>' . JText::_('SHOUT_EMPTY') . '</p></div>';
}
else
{
foreach ($shouts as $shout)
{
echo $helper->renderPost($shout);
}
}
?>
<div class="center-block">
<a href="#" id="jj-load-more" class="uk-button uk-button-primary"><?php echo JText::_('SHOUT_HISTORY_LOAD_MORE'); ?></a>
</div>
</div>
</div>
<?php else: ?>
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<?php if ($history == 1 ) : ?>
<div id="jj-history-modal" class="<?php echo $modal; ?>" tabindex="-1" role="dialog" aria-labelledby="JJ History Modal" aria-hidden="true">
<?php if ($framework == 'uikit') : ?>
<div class="uk-modal-dialog">
<a class="uk-modal-close uk-close"></a>
<div class="uk-modal-header">
<h3><?php echo JText::_('SHOUT_HISTORY'); ?></h3>
</div>
<div id="jj-shout-history" class="modal-body">
<div id="jj-shout-history" class="uk-overflow-container">
<?php
// Retrieves the shouts from the database
$shouts = $helper->getShouts(0, $number, $dataerror);
Expand All @@ -373,13 +347,46 @@ class="<?php echo $input_txtarea; ?>"
}
?>
<div class="center-block">
<a href="#" id="jj-load-more" class="btn btn-primary"><?php echo JText::_('SHOUT_HISTORY_LOAD_MORE'); ?></a>
<a href="#" id="jj-load-more" class="uk-button uk-button-primary"><?php echo JText::_('SHOUT_HISTORY_LOAD_MORE'); ?></a>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php else: ?>
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3><?php echo JText::_('SHOUT_HISTORY'); ?></h3>
</div>
<div id="jj-shout-history" class="modal-body">
<?php
// Retrieves the shouts from the database
$shouts = $helper->getShouts(0, $number, $dataerror);

// Counts the number of shouts retrieved from the database
$actualnumber = count($shouts);

if ($actualnumber == 0)
{
echo '<div><p>' . JText::_('SHOUT_EMPTY') . '</p></div>';
}
else
{
foreach ($shouts as $shout)
{
echo $helper->renderPost($shout);
}
}
?>
<div class="center-block">
<a href="#" id="jj-load-more" class="btn btn-primary"><?php echo JText::_('SHOUT_HISTORY_LOAD_MORE'); ?></a>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>

</div>

Expand All @@ -392,6 +399,7 @@ class="<?php echo $input_txtarea; ?>"
<?php } } ?>

var JJ_Framework_type = '<?php echo $framework; ?>';
var JJ_History = '<?php echo $history; ?>';

<?php if (file_exists(JPATH_ROOT . '/components/com_ajax/ajax.php')) : ?>

Expand Down Expand Up @@ -462,27 +470,28 @@ class="<?php echo $input_txtarea; ?>"
{
var JJ_Recaptcha = typeof(grecaptcha) == 'undefined' ? '' : grecaptcha.getResponse();

JJShoutbox.submitPost(name, '<?php echo $title; ?>', <?php echo $securitytype; ?>, '<?php echo JSession::getFormToken(); ?>', Itemid, instance, JJ_Recaptcha);
JJShoutbox.submitPost(name, '<?php echo $title; ?>', <?php echo $securitytype; ?>, '<?php echo JSession::getFormToken(); ?>', Itemid, instance, JJ_Recaptcha, JJ_History);
}
}


$('#jj-load-more').on('click', function(e){

e.preventDefault();
if (JJ_History == 1)
{
$('#jj-load-more').on('click', function(e){

e.preventDefault();

var Itemid = '<?php echo $Itemid; ?>';
JJShoutbox.getPostsHistory('<?php echo $title; ?>', Itemid, instance, offset);
var Itemid = '<?php echo $Itemid; ?>';
JJShoutbox.getPostsHistory('<?php echo $title; ?>', Itemid, instance, offset);

offset = offset + <?php echo $number; ?>;
});

offset = offset + <?php echo $number; ?>;
});
}

// Refresh the shoutbox posts every X seconds
setInterval(function(){
var Itemid = '<?php echo $Itemid; ?>';
var insertName = '<?php echo $displayName == 'user' ? $user->username : $user->name; ?>';
JJShoutbox.getPosts('<?php echo $title; ?>', '<?php echo $sound; ?>', '<?php echo $notifications; ?>', Itemid, instance, insertName);
JJShoutbox.getPosts('<?php echo $title; ?>', '<?php echo $sound; ?>', '<?php echo $notifications; ?>', Itemid, instance, insertName, JJ_History);
}, <?php echo $refresh; ?>);
});
<?php endif; ?>
Expand Down

0 comments on commit 9828646

Please sign in to comment.