Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge committed Mar 2, 2015
2 parents 3383ad5 + b629809 commit 1e71367
Show file tree
Hide file tree
Showing 15 changed files with 401 additions and 135 deletions.
10 changes: 10 additions & 0 deletions changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
- -> Removed
! -> Note

Version 3.1.0
+ Added option for required name
+ Added generic name as parameter if none used
+ Added Avatar integration for Gravatar, Kunena and JomSocial
^ Improved error reporting
^ Improved BBCode (now works with highlighted strings)
^ Replaced UI Framework detection with parameter
# Fixed smiley path for multilingual sites
# Fixed shout submits not working when assigned to single menu item

Version 3.0.0
+ Integrated AJAX for submitting and retrieving posts
+ Initially hide smilies with toggle option
Expand Down
29 changes: 25 additions & 4 deletions mod_shoutbox/fields/fade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,16 @@ protected function getLabel()
$js = '
jQuery(document).ready(function($) {
var select = $("#jform_params_securitytype");
var securityType = $("#jform_params_securitytype");
var public = $("#jform_params_recaptcha_public-lbl").parents("' . $parent . '");
var private = $("#jform_params_recaptcha_private-lbl").parents("' . $parent . '");
if( select.val() == 0 || select.val() == 2 ) {
if( securityType.val() == 0 || securityType.val() == 2 ) {
public.hide();
private.hide();
}
select.on("change", function() {
securityType.on("change", function() {
var value = this.value;
Expand All @@ -81,6 +80,28 @@ protected function getLabel()
}
});
var nameRequired = $("#jform_params_namerequired");
var genericName = $("#jform_params_genericname-lbl").parents("' . $parent . '");
if( nameRequired.val() == 1 ) {
genericName.hide();
}
nameRequired.on("change", function() {
var value = this.value;
if( value == 0 ) {
genericName.fadeIn();
}
else {
genericName.fadeOut();
}
});
});
';
Expand Down
77 changes: 76 additions & 1 deletion mod_shoutbox/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public function bbcodeFilter($message)
// Replace the smileys
foreach ($this->smileys as $smile => $url)
{
$replace = '<img src="' . $url . '" alt="' . $smile . '">';
$replace = '<img src="' . JUri::root() . $url . '" alt="' . $smile . '">';
$message = str_replace($smile, $replace, $message);
}

Expand Down Expand Up @@ -850,6 +850,75 @@ public function renderPost($shout, $layout = 'default')

return $output;
}

/**
* Gets the avatar of a user
*
* @param int $type The type of avatar.
*
* @return string The id of the user
*
* @since 3.0.1
*/
public function getAvatar($type, $id)
{
$user = JFactory::getUser($id);
$email = $user->email;
$url = '';

if ($type == 'gravatar')
{
$s = 30;
$d = 'mm';
$r = 'g';
$atts = array();

$url = 'http://www.gravatar.com/avatar/';
$url .= md5( strtolower( trim( $email ) ) );
$url .= "?s=$s&d=$d&r=$r";
$url = '<img src="' . $url . '"';
foreach ( $atts as $key => $val )
{
$url .= ' ' . $key . '="' . $val . '"';
}
$url .= ' />';
}
elseif ($type == 'kunena')
{
if (class_exists('KunenaFactory'))
{
$profile = KunenaFactory::getUser($user->id);
$avatar = $profile->getAvatarImage('kavatar','profile');

$url = $profile->getAvatarImage('kavatar','profile');
}
}
elseif ($type == 'jomsocial')
{
// JomSocial Profile Link
$jspath = JPATH_ROOT . '/components/com_community/libraries/core.php';

if (JFile::exists($jspath))
{
include_once $jspath;
$cuser = CFactory::getUser($user->id);
$avatarUrl = $cuser->getThumbAvatar();

$url = '<img src="' . $avatarUrl . '" height="30" width="30">';
}
else
{
JLog::add(JText::_('SHOUT_JOM_SOCIAL_NOT_INSTALLED'), JLog::WARNING, 'mod_shoutbox');
JFactory::getApplication()->enqueueMessage(JText::_('SHOUT_JOM_SOCIAL_NOT_INSTALLED'), 'error');
}
}
elseif ($type == 'cb')
{
// To-Do: Get CB avatar
}

return $url;
}

/**
* Processes the template output and puts in the shout variables
Expand Down Expand Up @@ -882,6 +951,12 @@ private function processTemplate($template, $shout)
{
switch (strtoupper($match[1]))
{
case 'AVATAR':
$avatar = $this->getAvatar($this->params->get('avatar', 'none'), $shout->user_id);
$message = str_replace('{' . $match[1] . '}', $avatar, $message);

break;

case 'TITLE':
$title = $this->shouttitle($user, $shout->ip);
$message = str_replace('{' . $match[1] . '}', $title, $message);
Expand Down
11 changes: 11 additions & 0 deletions mod_shoutbox/language/en-GB/en-GB.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
; Note : All ini files need to be saved as UTF-8

JJSHOUTBOX_DESCRIPTION="<h1 style='color:black; font-weight:bold; padding:0px;'>JJ Shoutbox</h1><p>Copyright &copy; <a href='http://www.joomjunk.co.uk'>JoomJunk</a></p><p>Released under GNU/GPL 3.0 License</p>"
SHOUT_AVATAR="Show Avatar"
SHOUT_AVATAR_DESC="Choose where you would like the user avatars to come from."
SHOUT_GRAVATAR="Gravatar"
SHOUT_MAXIMUMLABEL="Maximum Shouts"
SHOUT_MAXIMUMDESC="Type in the maximum amount of shouts you would like to be shown"
SHOUT_BORDERLABEL="Border Colour"
Expand Down Expand Up @@ -65,6 +68,10 @@ SHOUT_SOUNDLABEL="Sound Notifications"
SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout"
SHOUT_BBCODELABEL="BBCode"
SHOUT_BBCODEDESC="Select whether you would like to enable BBCode"
SHOUT_FRAMEWORK="UI Framework Integration"
SHOUT_FRAMEWORK_DESC="Select whether you wish to integrate the shoutbox styling with UIKit or Bootstrap"
SHOUT_BOOTSTRAP="Bootstrap"
SHOUT_UIKIT="UIKit"
SHOUT_DATABASEERRORSHOUT="There has been a database error"
SHOUT_DATABASEERROR="Apologies - You cannot post at this time due to a database error"
SHOUT_EMPTY="There are no posts in the Shoutbox"
Expand Down Expand Up @@ -101,6 +108,10 @@ SHOUT_GREATER_THAN_ZERO="You must delete more than 0 shouts"
SHOUT_NOT_INT="You must delete a integer number of shouts"
SHOUT_SWEAR_FILE_NOT_FOUND="The swear filter file cannot be found"
SHOUT_DATABASE_ERROR="There has been a database error: %s"
SHOUT_NAME_REQUIRED="Name required"
SHOUT_NAME_REQUIRED_DESC="Select whether or not a name is required to submit a post"
SHOUT_GENERIC_NAME="Generic name"
SHOUT_GENERIC_NAME_DESC="Choose a default name that will be used if no name is entered"
SHOUT_MASS_DELETE_OPTION="Mass Delete Button"
SHOUT_MASS_DELETE_OPTION_DESC="Select whether or not you would like to display the Mass Delete function (only admins can see this)"
WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed."
Expand Down
11 changes: 11 additions & 0 deletions mod_shoutbox/language/it-IT/it-IT.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
; Note : All ini files need to be saved as UTF-8

JJSHOUTBOX_DESCRIPTION="<h1 style='color:black; font-weight:bold; padding:0px;'>JJ Shoutbox</h1><p>Copyright &copy; <a href='http://www.joomjunk.co.uk'>JoomJunk</a></p><p>Rilasciata sotto licenza GNU/GPL 3.0</p>"
SHOUT_AVATAR="Show Avatar"
SHOUT_AVATAR_DESC="Choose where you would like the user avatars to come from."
SHOUT_GRAVATAR="Gravatar"
SHOUT_MAXIMUMLABEL="Urli Massimi"
SHOUT_MAXIMUMDESC="Digitare l'importo massimo di urli che si desidera essere mostrato"
SHOUT_BORDERLABEL="Colore Bordo"
Expand Down Expand Up @@ -65,6 +68,10 @@ SHOUT_SOUNDLABEL="Sound Notifications"
SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout"
SHOUT_BBCODELABEL="BBCode"
SHOUT_BBCODEDESC="Select whether you would like to enable BBCode"
SHOUT_FRAMEWORK="UI Framework Integration"
SHOUT_FRAMEWORK_DESC="Select whether you wish to integrate the shoutbox styling with UIKit or Bootstrap"
SHOUT_BOOTSTRAP="Bootstrap"
SHOUT_UIKIT="UIKit"
SHOUT_DATABASEERRORSHOUT="C'è stato un errore nel database"
SHOUT_DATABASEERROR="Ci scusiamo - Non è possibile pubblicare in questo momento a causa di un errore del database"
SHOUT_EMPTY="Non ci sono post nella Shoutbox"
Expand Down Expand Up @@ -101,6 +108,10 @@ SHOUT_GREATER_THAN_ZERO="È necessario eliminare più di 0 urli"
SHOUT_NOT_INT="È necessario eliminare un numero intero di urli"
SHOUT_SWEAR_FILE_NOT_FOUND="Il file del filtro parolacce non può essere trovato"
SHOUT_DATABASE_ERROR="C'è stato un errore nel database: %s"
SHOUT_NAME_REQUIRED="Name required"
SHOUT_NAME_REQUIRED_DESC="Select whether or not a name is required to submit a post"
SHOUT_GENERIC_NAME="Generic name"
SHOUT_GENERIC_NAME_DESC="Choose a default name that will be used if no name is entered"
SHOUT_MASS_DELETE_OPTION="Bottone cancellazione di massa"
SHOUT_MASS_DELETE_OPTION_DESC="Selezionare se si desidera visualizzare la funzione di cancellazione di massa (solo gli amministratori possono vedere questo)"
WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed."
Expand Down
11 changes: 11 additions & 0 deletions mod_shoutbox/language/nl-NL/nl_NL.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
; Note : All ini files need to be saved as UTF-8

JJSHOUTBOX_DESCRIPTION="<h1 style='color:black; font-weight:bold; padding:0px;'>JJ Shoutbox</h1><p>Copyright &copy; <a href='http://www.joomjunk.co.uk'>JoomJunk</a></p><p>Vrijgegeven onder GNU/GPL 3.0 Licentie</p>"
SHOUT_AVATAR="Show Avatar"
SHOUT_AVATAR_DESC="Choose where you would like the user avatars to come from."
SHOUT_GRAVATAR="Gravatar"
SHOUT_MAXIMUMLABEL="Maximaal aantal berichten"
SHOUT_MAXIMUMDESC="Geef het maximaal aantal berichten op, dat je wilt laten zien in de module."
SHOUT_BORDERLABEL="Rand kleur"
Expand Down Expand Up @@ -65,6 +68,10 @@ SHOUT_SOUNDLABEL="Sound Notifications"
SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout"
SHOUT_BBCODELABEL="BBCode"
SHOUT_BBCODEDESC="Select whether you would like to enable BBCode"
SHOUT_FRAMEWORK="UI Framework Integration"
SHOUT_FRAMEWORK_DESC="Select whether you wish to integrate the shoutbox styling with UIKit or Bootstrap"
SHOUT_BOOTSTRAP="Bootstrap"
SHOUT_UIKIT="UIKit"
SHOUT_DATABASEERRORSHOUT="Er is een database fout"
SHOUT_DATABASEERROR="Excuus - Je kunt op dit moment geen berichten plaatsen in verband met een database fout"
SHOUT_EMPTY="Er zijn geen berichten in de Shoutbox"
Expand Down Expand Up @@ -101,6 +108,10 @@ SHOUT_GREATER_THAN_ZERO="Je moet meer dan 0 berichten verwijderen"
SHOUT_NOT_INT="Je moet een aantal berichten verwijderen"
SHOUT_SWEAR_FILE_NOT_FOUND="Het vloekfilter bestand kan niet worden gevonden"
SHOUT_DATABASE_ERROR="Er is een database fout : %s"
SHOUT_NAME_REQUIRED="Name required"
SHOUT_NAME_REQUIRED_DESC="Select whether or not a name is required to submit a post"
SHOUT_GENERIC_NAME="Generic name"
SHOUT_GENERIC_NAME_DESC="Choose a default name that will be used if no name is entered"
SHOUT_MASS_DELETE_OPTION="Bulk verwijderingsknop"
SHOUT_MASS_DELETE_OPTION_DESC="Selecteer of de Bulk Verwijderingsknop functie ingeschakeld moet worden (alleen administrators kunnen dit zien)"
SHOUT_BBCODE_BOLD="B"
Expand Down
11 changes: 11 additions & 0 deletions mod_shoutbox/language/pl-PL/pl-PL.mod_shoutbox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
; Note : All ini files need to be saved as UTF-8

JJSHOUTBOX_DESCRIPTION="<h1 style='color:black; font-weight:bold; padding:0px;'>JJ Shoutbox</h1><p>Copyright &copy; <a href='http://www.joomjunk.co.uk'>JoomJunk</a></p><p>Wydany na licencji GNU/GPL 3.0</p>"
SHOUT_AVATAR="Show Avatar"
SHOUT_AVATAR_DESC="Choose where you would like the user avatars to come from."
SHOUT_GRAVATAR="Gravatar"
SHOUT_MAXIMUMLABEL="Ilość wpisów"
SHOUT_MAXIMUMDESC="Wpisz maksymalną ilość wpisów, jaka ma pojawiać się w oknie czata"
SHOUT_BORDERLABEL="Kolor obramowania"
Expand Down Expand Up @@ -65,6 +68,10 @@ SHOUT_SOUNDLABEL="Sound Notifications"
SHOUT_SOUNDDESC="Select whether or not you would like a sound notification when there's a new shout"
SHOUT_BBCODELABEL="BBCode"
SHOUT_BBCODEDESC="Select whether you would like to enable BBCode"
SHOUT_FRAMEWORK="UI Framework Integration"
SHOUT_FRAMEWORK_DESC="Select whether you wish to integrate the shoutbox styling with UIKit or Bootstrap"
SHOUT_BOOTSTRAP="Bootstrap"
SHOUT_UIKIT="UIKit"
SHOUT_DATABASEERRORSHOUT="Wystąpił błąd bazy danych"
SHOUT_DATABASEERROR="Przepraszamy - nie można wysłać wiadomości z powodu błędu bazy danych"
SHOUT_EMPTY="Brak wiadomości na czacie"
Expand Down Expand Up @@ -101,6 +108,10 @@ SHOUT_GREATER_THAN_ZERO="Ilość kasowanych wiadomości musi być większa od ze
SHOUT_NOT_INT="Ilość kasowanych wiadomości musi być liczbą całkowitą"
SHOUT_SWEAR_FILE_NOT_FOUND="Plik z filtrem przekleństw nie został znaleziony"
SHOUT_DATABASE_ERROR="Błąd bazy danych: %s"
SHOUT_NAME_REQUIRED="Name required"
SHOUT_NAME_REQUIRED_DESC="Select whether or not a name is required to submit a post"
SHOUT_GENERIC_NAME="Generic name"
SHOUT_GENERIC_NAME_DESC="Choose a default name that will be used if no name is entered"
SHOUT_MASS_DELETE_OPTION="Masowe usuwanie wpisów"
SHOUT_MASS_DELETE_OPTION_DESC="Wybierz, czy przycisk masowego usuwania wpisów ma być widoczny (tylko dla administratorów)"
WARNING_FREICHAT_IS_INSTALLED="Freichat appears to exist on your site. There are known conflicts with JJ Shoutbox and Freichat, therefore you cannot have both extensions installed."
Expand Down
37 changes: 24 additions & 13 deletions mod_shoutbox/media/css/mod_shoutbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html
*/

#jjshoutbox {
.jjshoutbox {
margin: auto;
width: 100%;
}
#jjshoutboxform {
margin: 0 auto;
}
#jjshoutbox > div,
#jjshoutbox textarea,
#jjshoutbox input {
.jjshoutbox > div,
.jjshoutbox textarea,
.jjshoutbox input {
box-sizing: border-box;
}
#jjshoutboxform textarea {
Expand Down Expand Up @@ -79,22 +79,33 @@
color: #FF0000;
font-weight: bold;
}
#jjshoutbox .jj_error {
.jjshoutbox .jj_error {
color:red;
font-weight:bold;
}
#jjshoutbox .jj_label {
.jjshoutbox .jj-shout-error {
display: none;
background: #F00;
color: #FFF;
margin: 7px 0 5px;
padding: 5px;
}
.jjshoutbox .jj-shout-error p {
margin: 0;
font-size: 12px;
}
.jjshoutbox .jj_label {
width: 70px;
display: inline-block;
}
#jjshoutbox .jj_input {
.jjshoutbox .jj_input {
width: 70px;
display: inline-block;
}
#jjshoutbox .jj_admin_label {
.jjshoutbox .jj_admin_label {
width: 30%;
}
#jjshoutbox .jj_admin_button {
.jjshoutbox .jj_admin_button {
width: 65%;
min-width: 90px;
background-color: #FF3333;
Expand Down Expand Up @@ -143,19 +154,19 @@
/**
Non-bootstrap styling for BB Code
**/
#jjshoutbox #jj_smiley_box {
.jjshoutbox #jj_smiley_box {
margin: 5px 0 10px;
white-space: normal;
}
#jjshoutbox #jj_smiley_box img {
.jjshoutbox #jj_smiley_box img {
cursor: pointer;
padding: 2px;
border:none;
}
#jjshoutbox .btn-toolbar {
.jjshoutbox .btn-toolbar {
margin-top: 10px;
}
#jjshoutbox .btn-group .btn {
.jjshoutbox .btn-group .btn {
cursor: pointer;
min-width: 30px;
padding: 2px 7px;
Expand Down
Loading

0 comments on commit 1e71367

Please sign in to comment.