Skip to content

Commit

Permalink
Merge pull request #155 from JoomJunk/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
C-Lodder committed Apr 29, 2015
2 parents 11d99da + 3390329 commit 7044013
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 37 deletions.
4 changes: 4 additions & 0 deletions changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
- -> Removed
! -> Note

Version 4.0.2
# Fixed PHP error when no menu item ID exists
^ Minor code tweaks

Version 4.0.1
# Fixed parameter

Expand Down
16 changes: 14 additions & 2 deletions mod_shoutbox/media/js/mod_shoutbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,16 @@ jQuery(document).ready(function($) {
request['jjshout[human]'] = instance.find('input[name="jjshout[human]"]').val();
}

// If there is an active menu item then we need to add it to the request.
if (Itemid !== null)
{
request['Itemid'] = Itemid;
}

// AJAX request
$.ajax({
type: 'POST',
url: 'index.php?option=com_ajax&module=shoutbox&method=submit&Itemid='+Itemid+'&format=json',
url: 'index.php?option=com_ajax&module=shoutbox&method=submit&format=json',
data: request,
success:function(response){
if (response.success)
Expand Down Expand Up @@ -224,10 +230,16 @@ jQuery(document).ready(function($) {
'jjshout[title]' : title,
};

// If there is an active menu item then we need to add it to the request.
if (Itemid !== null)
{
request['Itemid'] = Itemid;
}

// AJAX request
$.ajax({
type: 'POST',
url: 'index.php?option=com_ajax&module=shoutbox&method=getPosts&Itemid='+Itemid+'&format=json',
url: 'index.php?option=com_ajax&module=shoutbox&method=getPosts&format=json',
data: request,
success:function(response){
if (response.success)
Expand Down
61 changes: 31 additions & 30 deletions mod_shoutbox/mod_shoutbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,41 @@
$helper = new ModShoutboxHelper($title);
$params = $helper->getParams();

$displayName = $params->get('loginname', 'user');
$smile = $params->get('smile');
$swearcounter = $params->get('swearingcounter', 1);
$swearnumber = $params->get('swearingnumber');
$number = $params->get('maximum');
$profile = $params->get('profile');
$avatar = $params->get('avatar', 'none');
$date = $params->get('date');
$securitytype = $params->get('securitytype', 0);
$publicKey = $params->get('recaptcha-public');
$privateKey = $params->get('recaptcha-private');
$mass_delete = $params->get('mass_delete', 0);
$permissions = $params->get('guestpost');
$deletecolor = $params->get('deletecolor', '#FF0000');
$bordercolour = $params->get('bordercolor', '#FF3C16');
$borderwidth = $params->get('borderwidth', '1');
$headercolor = $params->get('headercolor', '#D0D0D0');
$bbcode = $params->get('bbcode', 1);
$entersubmit = $params->get('entersubmit', 0);
$sound = $params->get('sound', 1);
$framework = $params->get('framework', 'bootstrap');
$genericName = $params->get('genericname', 'Anonymous');
$nameRequired = $params->get('namerequired', 0);
$alertLength = $params->get('alertlength', '50');
$warnLength = $params->get('warnlength', '10');
$messageLength = $params->get('messagelength', '200');
$refresh = $params->get('refresh', 10) * 1000;
$remainingLength = JText::_('SHOUT_REMAINING');
$displayName = $params->get('loginname', 'user');
$smile = $params->get('smile');
$swearcounter = $params->get('swearingcounter', 1);
$swearnumber = $params->get('swearingnumber');
$number = $params->get('maximum');
$profile = $params->get('profile');
$avatar = $params->get('avatar', 'none');
$date = $params->get('date');
$securitytype = $params->get('securitytype', 0);
$publicKey = $params->get('recaptcha-public');
$privateKey = $params->get('recaptcha-private');
$mass_delete = $params->get('mass_delete', 0);
$permissions = $params->get('guestpost');
$deletecolor = $params->get('deletecolor', '#FF0000');
$bordercolour = $params->get('bordercolor', '#FF3C16');
$borderwidth = $params->get('borderwidth', '1');
$headercolor = $params->get('headercolor', '#D0D0D0');
$bbcode = $params->get('bbcode', 1);
$entersubmit = $params->get('entersubmit', 0);
$sound = $params->get('sound', 1);
$framework = $params->get('framework', 'bootstrap');
$genericName = $params->get('genericname', 'Anonymous');
$nameRequired = $params->get('namerequired', 0);
$alertLength = $params->get('alertlength', '50');
$warnLength = $params->get('warnlength', '10');
$messageLength = $params->get('messagelength', '200');
$refresh = $params->get('refresh', 10) * 1000;
$remainingLength = JText::_('SHOUT_REMAINING');

// Assemble the factory variables needed
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$app = JFactory::getApplication();
$Itemid = $app->getMenu()->getActive()->id;
$activeMenuItem = $app->getMenu()->getActive();
$Itemid = is_null($activeMenuItem) ? null : $activeMenuItem->id;

// Apply UI framework styling
switch ($framework)
Expand Down Expand Up @@ -146,4 +147,4 @@
}
}

require JModuleHelper::getLayoutPath('mod_shoutbox');
require JModuleHelper::getLayoutPath('mod_shoutbox');
2 changes: 1 addition & 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>4.0.1</version>
<version>4.0.2</version>
<description>JJSHOUTBOX_DESCRIPTION</description>

<install>
Expand Down
1 change: 1 addition & 0 deletions mod_shoutbox/sql/mysql/updates/4.0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder file for database changes for version 4.0.2
1 change: 1 addition & 0 deletions mod_shoutbox/sql/postgresql/updates/4.0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder file for database changes for version 4.0.2
6 changes: 2 additions & 4 deletions mod_shoutbox/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
<?php if (file_exists(JPATH_ROOT . '/components/com_ajax/ajax.php')) : ?>
jQuery(document).ready(function($) {

var Itemid = '<?php echo $Itemid; ?>';
var Itemid = <?php echo $Itemid ? $Itemid : 'null'; ?>;
var instance = $('#<?php echo $uniqueIdentifier; ?>');

var entersubmit = '<?php echo $entersubmit; ?>';
Expand Down Expand Up @@ -248,8 +248,6 @@ function doShoutboxSubmission()
var shoutboxName = instance.find('#shoutbox-name').val();
var shoutboxMsg = instance.find('#jj_message').val();

console.log(instance);

<?php if($displayName == 'user' && !$user->guest){ ?>
var name = "<?php echo $user->username;?>";
<?php } elseif($displayName == 'real' && !$user->guest) { ?>
Expand Down Expand Up @@ -291,4 +289,4 @@ function doShoutboxSubmission()
}, <?php echo $refresh; ?>);
});
<?php endif; ?>
</script>
</script>

0 comments on commit 7044013

Please sign in to comment.