Skip to content

Commit

Permalink
fixed chat amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
LMOspaceace committed Jun 19, 2016
1 parent 28d2175 commit 2522352
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 19 deletions.
6 changes: 3 additions & 3 deletions config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
spaceace_ajaxchat_popup:
path: /chat/popup
defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction}
defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction, page: popup}

spaceace_ajaxchat_archive:
path: /chat/archive
defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction}
defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction, page: archive}

spaceace_ajaxchat_edit:
path: /chat/edit/{chat_id}
Expand All @@ -28,4 +28,4 @@ spaceace_ajaxchat_quote:

spaceace_ajaxchat_chat:
path: /chat
defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction}
defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction, page: chat}
21 changes: 17 additions & 4 deletions controller/chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,21 @@ public function index()
*
* @return multi
*/
public function defaultAction()
public function defaultAction($page)
{
//Sets message amount depending on page being used
if ($page === 'popup')
{
$chat_message_total = $this->config['ajax_chat_popup_amount'];
}
if ($page === 'chat')
{
$chat_message_total = $this->config['ajax_chat_chat_amount'];
}
if ($page === 'archive')
{
$chat_message_total = $this->config['ajax_chat_archive_amount'];
}
// sets a few variables before the actions
$this->mode = $this->request->variable('mode', 'default');
$this->last_id = $this->request->variable('last_id', 0);
Expand All @@ -292,7 +305,7 @@ public function defaultAction()
LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id
WHERE c.message_id > ' . (int) $this->last_id . '
ORDER BY c.message_id DESC';
$result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']);
$result = $this->db->sql_query_limit($sql, (int) $chat_message_total);
$rows = $this->db->sql_fetchrowset($result);

foreach ($rows as $row)
Expand Down Expand Up @@ -516,7 +529,7 @@ public function readAction()
LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id
WHERE c.message_id > ' . (int) $this->last_id . '
ORDER BY c.message_id DESC';
$result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']);
$result = $this->db->sql_query_limit($sql, (int) $chat_message_total);
$rows = $this->db->sql_fetchrowset($result);

if (!sizeof($rows) && ((time() - 60) < $this->last_time))
Expand Down Expand Up @@ -823,7 +836,7 @@ public function addAction()
LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id
WHERE c.message_id > ' . (int) $this->last_id . '
ORDER BY c.message_id DESC';
$result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']);
$result = $this->db->sql_query_limit($sql, (int) $chat_message_total);
$rows = $this->db->sql_fetchrowset($result);

if (!sizeof($rows) && ((time() - 60) < $this->last_time))
Expand Down
2 changes: 1 addition & 1 deletion styles/Bluespace/template/chat_body_font_colour_hold.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="chat_colour_palette">
<div id="chat_colour_palette" style="display: none;">
<table width="50%">
<div id="fc">
</div>
Expand Down
2 changes: 1 addition & 1 deletion styles/Deepspace/template/chat_body_font_colour_hold.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="chat_colour_palette">
<div id="chat_colour_palette" style="display: none;">
<table width="50%">
<div id="fc">
</div>
Expand Down
2 changes: 1 addition & 1 deletion styles/Prospace/template/chat_body_font_colour_hold.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="chat_colour_palette">
<div id="chat_colour_palette" style="display: none;">
<table width="50%">
<div id="fc">
</div>
Expand Down
4 changes: 2 additions & 2 deletions styles/all/template/chat_body_buttons.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- IF S_BBCODE_ALLOWED -->
<div id="chat_bbcodes">
<div id="chat_bbcodes" style="display: none;">
<!-- INCLUDE posting_buttons.html -->
</div>
<!-- ENDIF -->
<div id="chat_smilies" style="display: none;">
<div id="chat_smilies" style="display: none;">
<!-- IF S_SMILIES_ALLOWED -->
<!-- BEGIN smiley -->
<a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" style="margin: 4px 2px 0" /></a>
Expand Down
2 changes: 1 addition & 1 deletion styles/all/template/event/overall_header_head_append.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- IF S_CHAT_ENABLED and S_AJAX_CHAT_VIEW -->
<!-- IF S_CHAT_ENABLED and S_AJAX_CHAT_VIEW or SCRIPT_NAME == 'app/chat' -->
<!-- INCLUDECSS @spaceace_ajaxchat/ajax_chat.css -->
<!-- ENDIF -->
5 changes: 0 additions & 5 deletions styles/all/theme/ajax_chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
}

#chat_colour_palette {
display: none;
text-align: center;
padding-bottom: 5px;
}
Expand All @@ -47,10 +46,6 @@
margin: 0 auto;
}

#chat_bbcodes {
display: none;
}

#ajaxchat .navbar.chatrules {
margin: 0 5px 3px 5px;
border-radius: 0 0 7px 7px;
Expand Down
2 changes: 1 addition & 1 deletion styles/prosilver/template/chat_body_font_colour_hold.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="chat_colour_palette">
<div id="chat_colour_palette" style="display: none;">
<table width="50%">
<div id="fc">
</div>
Expand Down

0 comments on commit 2522352

Please sign in to comment.