Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
Shoutit to ShoutIt refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilBau committed Jan 3, 2013
1 parent e0b41c3 commit ae73778
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
- New features: - Send a message to a specific group only
- Block settings available : length of a message,
number of messages displayed,
refresh rate (common to all Shoutit blocks)
refresh rate (common to all ShoutIt blocks)
2 changes: 1 addition & 1 deletion docs/credits.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Shoutit 2.x & 3.x:
ShoutIt 2.x & 3.x:
-------------------
Gabriel Freinbichler
Philippe Baudrion - UniGE/FTI: Zikula 1.3.x refactoring
Expand Down
6 changes: 3 additions & 3 deletions javascript/Shoutit.js → javascript/ShoutIt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Shoutit module for Zikula Application Framework
* ShoutIt module for Zikula Application Framework
* @author Gabriel Freinbichler
* refactored for zk 1.3 by Philippe Baudrion - UniGE/FTI
*/
Expand All @@ -23,7 +23,7 @@

this.updater = new Ajax.PeriodicalUpdater(
'shoutitcontent_' + this.bid,
Zikula.Config.baseURL + 'ajax.php?module=Shoutit&func=getmessages',
Zikula.Config.baseURL + 'ajax.php?module=ShoutIt&func=getmessages',
{
method: 'post',
parameters: {bid: this.bid},
Expand All @@ -43,7 +43,7 @@
if (((this.grpMsg == '1' && e != '-') && m != '') ||
(this.grpMsg == '0' && m != '')) {
new Zikula.Ajax.Request(
Zikula.Config.baseURL + "ajax.php?module=Shoutit&func=savemessages",
Zikula.Config.baseURL + "ajax.php?module=ShoutIt&func=savemessages",
{
method: 'post',
parameters:
Expand Down
14 changes: 7 additions & 7 deletions lib/Shoutit/Api/User.php → lib/ShoutIt/Api/User.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Shoutit module for Zikula Application Framework
* ShoutIt module for Zikula Application Framework
*
* @author Gabriel Freinbichler
* refactored for zk 1.3 by Philippe Baudrion - UniGE/FTI
Expand All @@ -13,7 +13,7 @@
/**
* User API
*/
class Shoutit_Api_User extends Zikula_AbstractApi
class ShoutIt_Api_User extends Zikula_AbstractApi
{
/**
* Get all allowed messages from the database
Expand All @@ -32,7 +32,7 @@ public function getMessages($args) {
$tables = DBUtil::getTables();
$shColumn = $tables['shoutit_messages_column'];
$orderBy= "ORDER BY $shColumn[cr_date] DESC";
$limitNumRows = ModUtil::getVar('Shoutit', "shoutit_lastx_messages_{$bid}");
$limitNumRows = ModUtil::getVar('ShoutIt', "shoutit_lastx_messages_{$bid}");
$where = '';
$joinInfo[] = array (
'join_table' => 'users', // table for the join
Expand All @@ -43,8 +43,8 @@ public function getMessages($args) {
);

// Only select user own messages and messages from own registered group(s)
if(ModUtil::getVar('Shoutit', "shoutit_group_messages_{$bid}") == '1' &&
!SecurityUtil::checkPermission('Shoutit::', $bid.'::', ACCESS_MODERATE)) {
if(ModUtil::getVar('ShoutIt', "shoutit_group_messages_{$bid}") == '1' &&
!SecurityUtil::checkPermission('ShoutIt::', $bid.'::', ACCESS_MODERATE)) {

$uid = UserUtil::getVar('uid');
$where = "WHERE $shColumn[cr_uid] = $uid";
Expand Down Expand Up @@ -104,7 +104,7 @@ public function deleteMessages($args) {
return LogUtil::registerArgsError();
}

$this->throwForbiddenUnless(SecurityUtil::checkPermission('Shoutit::', $args['bid'].'::', ACCESS_DELETE), LogUtil::getErrorMsgPermission());
$this->throwForbiddenUnless(SecurityUtil::checkPermission('ShoutIt::', $args['bid'].'::', ACCESS_DELETE), LogUtil::getErrorMsgPermission());

$tables = DBUtil::getTables();
$shColumns = $tables['shoutit_messages_column'];
Expand All @@ -120,4 +120,4 @@ public function deleteMessages($args) {
}
// end of class
}
?>
?>
18 changes: 9 additions & 9 deletions lib/Shoutit/Block/Shoutit.php → lib/ShoutIt/Block/ShoutIt.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Shoutit module for Zikula Application Framework
* ShoutIt module for Zikula Application Framework
*
* @author Gabriel Freinbichler
* refactored for zk 1.3 by Philippe Baudrion - UniGE/FTI
Expand All @@ -9,7 +9,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @version $Id$
*/
class Shoutit_Block_Shoutit extends Zikula_Controller_AbstractBlock
class ShoutIt_Block_ShoutIt extends Zikula_Controller_AbstractBlock
{
/**
* Initialise block.
Expand Down Expand Up @@ -92,17 +92,17 @@ public function modify($blockinfo)
// defaults
if (!isset($vars['nbMsg'])) {
$vars['nbMsg'] = '100';
ModUtil::setVar('Shoutit', "shoutit_lastx_messages_{$blockinfo['bid']}", '100');
ModUtil::setVar('ShoutIt', "shoutit_lastx_messages_{$blockinfo['bid']}", '100');
}
if (!isset($vars['refRate'])) {
$vars['refRate'] = ModUtil::getVar('Shoutit', 'shoutit_refresh_rate');
$vars['refRate'] = ModUtil::getVar('ShoutIt', 'shoutit_refresh_rate');
}
if (!isset($vars['msgLength'])) {
$vars['msgLength'] = '70';
}
if (!isset($vars['grpMsg'])) {
$vars['grpMsg'] = '0';
ModUtil::setVar('Shoutit', "shoutit_group_messages_{$blockinfo['bid']}", '0');
ModUtil::setVar('ShoutIt', "shoutit_group_messages_{$blockinfo['bid']}", '0');
}
if (!isset($vars['delMsg'])) {
$vars['delMsg'] = '0';
Expand Down Expand Up @@ -131,7 +131,7 @@ public function update($blockinfo)
$msgLength = ($msgLength >= 20) ? $msgLength : '20';

if($delMsg) {
ModUtil::apiFunc('Shoutit', 'user', 'deleteMessages', array(
ModUtil::apiFunc('ShoutIt', 'user', 'deleteMessages', array(
'bid' => $blockinfo['bid']
));
}
Expand All @@ -143,9 +143,9 @@ public function update($blockinfo)
$vars['grpMsg'] = $grpMsg;
$vars['delMsg'] = '0';

ModUtil::setVar('Shoutit', "shoutit_lastx_messages_{$blockinfo['bid']}", $nbMsg);
ModUtil::setVar('Shoutit', 'shoutit_refresh_rate', $refRate);
ModUtil::setVar('Shoutit', "shoutit_group_messages_{$blockinfo['bid']}", $grpMsg);
ModUtil::setVar('ShoutIt', "shoutit_lastx_messages_{$blockinfo['bid']}", $nbMsg);
ModUtil::setVar('ShoutIt', 'shoutit_refresh_rate', $refRate);
ModUtil::setVar('ShoutIt', "shoutit_group_messages_{$blockinfo['bid']}", $grpMsg);

$blockinfo['content'] = BlockUtil::varsToContent($vars);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Shoutit module for Zikula Application Framework
* ShoutIt module for Zikula Application Framework
*
* @author Gabriel Freinbichler
* refactored for zk 1.3 by Philippe Baudrion - UniGE/FTI
Expand All @@ -9,7 +9,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @version $Id$
*/
class Shoutit_Controller_Ajax extends Zikula_Controller_AbstractAjax
class ShoutIt_Controller_Ajax extends Zikula_Controller_AbstractAjax
{
public function getmessages()
{
Expand All @@ -20,9 +20,9 @@ public function getmessages()
throw new Zikula_Exception_Fatal($this->__('Ajax Error! Missing required parameter.'));
}

$this->throwForbiddenUnless(SecurityUtil::checkPermission('Shoutit::', $bid.'::', ACCESS_OVERVIEW), LogUtil::getErrorMsgPermission());
$this->throwForbiddenUnless(SecurityUtil::checkPermission('ShoutIt::', $bid.'::', ACCESS_OVERVIEW), LogUtil::getErrorMsgPermission());

$messages = ModUtil::apiFunc('Shoutit', 'user', 'getMessages', array('bid' => $bid));
$messages = ModUtil::apiFunc('ShoutIt', 'user', 'getMessages', array('bid' => $bid));

Zikula_AbstractController::configureView();
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
Expand Down Expand Up @@ -52,9 +52,9 @@ public function savemessages()
throw new Zikula_Exception_Fatal($this->__('Ajax Error! Missing required parameter.'));
}

$this->throwForbiddenUnless(SecurityUtil::checkPermission('Shoutit::', $bid.'::', ACCESS_COMMENT), LogUtil::getErrorMsgPermission());
$this->throwForbiddenUnless(SecurityUtil::checkPermission('ShoutIt::', $bid.'::', ACCESS_COMMENT), LogUtil::getErrorMsgPermission());

$result = ModUtil::apiFunc('Shoutit', 'user', 'saveMessages', array(
$result = ModUtil::apiFunc('ShoutIt', 'user', 'saveMessages', array(
'message' => $message,
'gid' => $gid,
'bid' => $bid
Expand Down
14 changes: 7 additions & 7 deletions lib/Shoutit/Installer.php → lib/ShoutIt/Installer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Shoutit module for Zikula Application Framework
* ShoutIt module for Zikula Application Framework
*
* @author Gabriel Freinbichler
* refactored for zk 1.3 by Philippe Baudrion - UniGE/FTI
Expand All @@ -11,11 +11,11 @@
*/

/**
* initialise Shoutit module once
* initialise ShoutIt module once
*
* @return boolean true/false
*/
class Shoutit_Installer extends Zikula_AbstractInstaller
class ShoutIt_Installer extends Zikula_AbstractInstaller
{
public function install()
{
Expand All @@ -26,7 +26,7 @@ public function install()
}

// Module variables initialisation
ModUtil::setVar('Shoutit', 'shoutit_refresh_rate', '8');
ModUtil::setVar('ShoutIt', 'shoutit_refresh_rate', '8');

// Register hook
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
Expand All @@ -46,7 +46,7 @@ public function upgrade($oldversion)
{
case '2.0':
// Module variables initialisation
ModUtil::setVar('Shoutit', 'shoutit_refresh_rate', '10');
ModUtil::setVar('ShoutIt', 'shoutit_refresh_rate', '10');

// Register hook
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
Expand All @@ -55,14 +55,14 @@ public function upgrade($oldversion)
}

/**
* Deletes Shoutit modules
* Deletes ShoutIt modules
*
* @return boolean true/false
*/
public function uninstall()
{
$result = DBUtil::dropTable('shoutit_messages');
$result = $result && ModUtil::delVar('Shoutit');
$result = $result && ModUtil::delVar('ShoutIt');

HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles());

Expand Down
10 changes: 5 additions & 5 deletions lib/Shoutit/Version.php → lib/ShoutIt/Version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Shoutit module for Zikula Application Framework
* ShoutIt module for Zikula Application Framework
*
* @author Gabriel Freinbichler
* refactored for zk 1.3 by Philippe Baudrion - UniGE/FTI
Expand All @@ -9,14 +9,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @version $Id$
*/
class Shoutit_Version extends Zikula_AbstractVersion
class ShoutIt_Version extends Zikula_AbstractVersion
{
public function getMetaData()
{
$meta = array();

$meta['name'] = 'Shoutit';
$meta['displayname'] = $this->__('Shoutit');
$meta['name'] = 'ShoutIt';
$meta['displayname'] = $this->__('ShoutIt');
$meta['description'] = $this->__('Ajax shoutbox');
$meta['version'] = '3.0.0';
$meta['url'] = $this->__('shoutit');
Expand All @@ -28,7 +28,7 @@ public function getMetaData()
$meta['official'] = 0;
$meta['author'] = 'Gabriel Freinbichler & Philippe Baudrion - UniGE/FTI';
$meta['contact'] = 'http://www.cmods-dev.de';
$meta['securityschema'] = array('Shoutit::' => 'gid::');
$meta['securityschema'] = array('ShoutIt::' => 'gid::');
$meta['core_min'] = '1.3.0';
$meta['core_max'] = '1.3.99';

Expand Down
4 changes: 2 additions & 2 deletions style/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Shoutit module for Zikula
* ShoutIt module for Zikula
* @author Gabriel Freinbichler & refactored by Philippe Baudrion UniGE/FTI
*/
.shoutit_contentwrap{border:1px dashed #CCCCCC;height:200px;margin-bottom:5px;overflow: auto;}
Expand All @@ -12,4 +12,4 @@
.shoutit_counter{width:2.2em;border:none;}
.shoutit_message{border:1px solid #CCCCCC;margin:3px 0px;padding:3px 2px; width:97%}
.shoutit_button{margin-top: 4px;}
.shoutit_input .bb_standardsmilies{width:99% !important;}
.shoutit_input .bb_standardsmilies{width:99% !important;}
6 changes: 3 additions & 3 deletions templates/admin/block_modify.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="z-formrow">
<label for='shoutit_refRate'>{gt text='Refresh rate in sec.'}</label>
<input type='text' id='shoutit_refRate' mandatory='1' name='shoutit_refRate' maxLength='2' value={$vars.refRate|safetext} />
<em class="z-formnote z-sub">{gt text="Common value for all Shoutit block instances.<br />Default is 8, minimum is 6"}</em>
<em class="z-formnote z-sub">{gt text="Common value for all ShoutIt block instances.<br />Default is 8, minimum is 6"}</em>
</div>

<div class="z-formrow">
Expand All @@ -23,11 +23,11 @@
{else}
<input id='shoutit_grpMsg' type='checkbox' name='shoutit_grpMsg' value='1' />
{/if}
<em class="z-formnote z-sub">{gt text='Only display user messages and messages from same user group(s).<br />Please set Shoutit permissions according your needs before (Read install.txt).'}</em>
<em class="z-formnote z-sub">{gt text='Only display user messages and messages from same user group(s).<br />Please set ShoutIt permissions according your needs before (Read install.txt).'}</em>
</div>

<div class="z-formrow">
<label for='shoutit_delMsg'>{gt text='Clear all messages?'}</label>
<input id='shoutit_delMsg' type='checkbox' name='shoutit_delMsg' value='1' />
<em class="z-sub z-warningmsg">{gt text='Tick the box, be careful when pressing \'Save\' this will delete all messages from the block.'}</em>
</div>
</div>
6 changes: 3 additions & 3 deletions templates/user/box.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{* $Id$ *}
{ajaxheader modname='Shoutit' filename='Shoutit.js'}
{ajaxheader modname='ShoutIt' filename='ShoutIt.js'}

<div class="shoutit" id="shoutit_{$bid}">
<div class="shoutit_contentwrap" id="shoutit_contentwrap_{$bid}">
Expand Down Expand Up @@ -31,8 +31,8 @@
{/if}
<script type="text/javascript">
// <![CDATA[
var shoutit_{{$bid}} = new shoutit({{$bid}}, {{$modvars.Shoutit.shoutit_refresh_rate}}, {{$msgLength}}, {{$postPerm}}, {{$grpMsg}});
var shoutit_{{$bid}} = new shoutit({{$bid}}, {{$modvars.ShoutIt.shoutit_refresh_rate}}, {{$msgLength}}, {{$postPerm}}, {{$grpMsg}});
// ]]>
</script>
{* pndebug *}
</div>
</div>

0 comments on commit ae73778

Please sign in to comment.