Skip to content

Commit

Permalink
Merge pull request #3 from Cotonti/master
Browse files Browse the repository at this point in the history
Update from Cotonti
  • Loading branch information
devkont committed Aug 10, 2015
2 parents bd76f35 + e3dbb52 commit 3e30528
Show file tree
Hide file tree
Showing 15 changed files with 243 additions and 213 deletions.
2 changes: 2 additions & 0 deletions modules/pm/inc/pm.list.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
$out['subtitle'] = cot_title('{BOX} ({COUNT}) - {PM}', $title_params);
$out['head'] .= $R['code_noindex'];

Resources::linkFileFooter(cot::$cfg['modules_dir'].'/pm/js/pm.js');

/* === Title === */
$totallines = $db->query("SELECT COUNT(*) FROM $db_pm WHERE $sqlfilter")->fetchColumn();
$elem = ($f == 'sentbox') ? 'pm_touserid' : 'pm_fromuserid';
Expand Down
24 changes: 20 additions & 4 deletions modules/pm/inc/pm.message.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
$f = 'sentbox';
$title[] = array(cot_url('pm', 'f=sentbox'), $L['pm_sentbox']);
$row['pm_icon_edit'] = ($row['pm_tostate'] == 0) ? cot_rc_link(cot_url('pm', 'm=send&id='.$row['pm_id']), $L['Edit']) : '';
$row['pm_edit_url'] = ($row['pm_tostate'] == 0) ? cot_url('pm', 'm=send&id='.$row['pm_id']) : '';
$to = $row['pm_touserid'];
$star_class = ($row['pm_fromstate'] == 2) ? 1 : 0;
$totalcount = $totalsentbox;
Expand All @@ -80,6 +81,8 @@
$out['subtitle'] = cot_title('{BOX} ({COUNT}) - {PM}', $title_params);
$out['head'] .= $R['code_noindex'];

Resources::linkFileFooter(cot::$cfg['modules_dir'].'/pm/js/pm.js');

/* === Hook === */
foreach (cot_getextplugins('pm.main') as $pl)
{
Expand Down Expand Up @@ -220,9 +223,12 @@
}
$t->assign(array(
'PM_QUOTE' => cot_rc_link(cot_url('pm', 'm=message&id='.$id.'&q=quote&history='.(int)$history.'&d='.$durl), $L['Quote'], array('onclick' => $onclick)),
'PM_QUOTE_URL' => cot_url('pm', 'm=message&id='.$id.'&q=quote&history='.(int)$history.'&d='.$durl),
'PM_QUOTE_ONCLICK' => $onclick,
'PM_FORM_SEND' => cot_url('pm', 'm=send&a=send&to='.$to),
'PM_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'),
'PM_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code,
'PM_FORM_NOT_TO_SENTBOX' => cot_checkbox(false, 'fromstate', cot::$L['pm_notmovetosentbox'], '', '3')
));

/* === Hook === */
Expand All @@ -241,26 +247,36 @@
}

$pm_username = cot_build_user($row_user['user_id'], htmlspecialchars($row_user['user_name']));
$title[] = array(cot_url('users', 'm=details&id='.$row_user['user_id']), $row_user['user_name']);
$title[] = array(cot_url('users', 'm=details&id='.$row_user['user_id']), $row_user['user_name']);
$title[] = array(cot_url('pm', 'm=message&id='.$id), $row['pm_title']);

$url_delete = cot_url('pm', array('m'=>'edit', 'a'=>'delete', 'id'=>$row['pm_id'],'x'=>cot::$sys['xk'], 'f'=>$f));

$t->assign(array(
'PM_ID' => $row['pm_id'],
'PM_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']),
'PM_SENDNEWPM' => ($usr['auth_write']) ? cot_rc_link(cot_url('pm', 'm=send'), $L['pm_sendnew'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '',
'PM_SENDNEWPM_URL' => cot_url('pm', 'm=send'),
'PM_INBOX' => cot_rc_link(cot_url('pm'), $L['pm_inbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')),
'PM_INBOX_URL' => cot_url('pm'),
'PM_INBOX_COUNT' => $totalinbox,
'PM_SENTBOX' => cot_rc_link(cot_url('pm', 'f=sentbox'), $L['pm_sentbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')),
'PM_SENTBOX_URL' => cot_url('pm', 'f=sentbox'),
'PM_SENTBOX_COUNT' => $totalsentbox,
'PM_ID' => $row['pm_id'],
'PM_STATE' => $row['pm_tostate'],
'PM_STAR' => cot_rc($star_class ? 'pm_icon_unstar' : 'pm_icon_star', array('link' => cot_url('pm', 'f='.$f.'&filter='.$filter.'&a=star&id='.$row['pm_id'].'&d='.$durl))),
'PM_DATE' => cot_date('datetime_medium', $row['pm_date']),
'PM_DATE_STAMP' => $row['pm_date'],
'PM_TITLE' => htmlspecialchars($row['pm_title']),
'PM_TEXT' => '<div id="pm_text">'.$pm_maindata.'</div>',
'PM_DELETE' => cot_rc_link(cot_url('pm', 'm=edit&a=delete&'.cot_xg().'&id='.$row['pm_id'].'&f='.$f), $L['Delete'], array('class'=> $cfg['pm']['turnajax'] ? 'ajax' : '')),
'PM_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url(cot_url('pm', 'm=edit&a=delete&'.cot_xg().'&id='.$row['pm_id'].'&f='.$f)), $L['Delete'], array('class'=> $cfg['pm']['turnajax'] ? 'ajax' : '')),
'PM_DELETE' => cot_rc_link($url_delete , $L['Delete'], array('class'=> $cfg['pm']['turnajax'] ? 'ajax' : '')),
'PM_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url($url_delete ), $L['Delete'], array('class'=> 'confirmLink')),
'PM_DELETE_CONFIRM_URL' => cot_confirm_url($url_delete),
'PM_DELETE_URL' => $url_delete ,
'PM_EDIT' => $row['pm_icon_edit'],
'PM_EDIT_URL' => (!empty($row['pm_edit_url'])) ? $row['pm_edit_url'] : '',
'PM_HISTORY' => cot_rc_link(cot_url('pm', 'm=message&id='.$id.'&q='.$q.'&history=1&d='.$durl), $L['pm_messagehistory'], array("rel" => "get-ajaxHistory", 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')),
'PM_HISTORY_URL' => cot_url('pm', 'm=message&id='.$id.'&q='.$q.'&history=1&d='.$durl),
'PM_SENT_TYPE' => ($f == 'sentbox') ? $L['Recipient'] : $L['Sender']
));
$t->assign(cot_generate_usertags($row_user, 'PM_USER_'));
Expand Down
1 change: 1 addition & 0 deletions modules/pm/inc/pm.send.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
'PMSEND_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'),
'PMSEND_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code,
'PMSEND_FORM_TOUSER' => cot_textarea('newpmrecipient', $touser, 3, 56, 'class="userinput"'),
'PMSEND_FORM_NOT_TO_SENTBOX' => cot_checkbox(false, 'fromstate', cot::$L['pm_notmovetosentbox'], '', '3')
));

/* === Hook === */
Expand Down
55 changes: 32 additions & 23 deletions modules/pm/js/pm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
$('.pm-star').live('mouseenter', function () {
/**
* PM module
*
* @package PM
* @copyright (c) Cotonti Team
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/

$( document ).on( "mouseenter", ".pm-star", function() {
if (!$(this).hasClass('pm-star-readonly'))
{
$(this).addClass('pm-star-hover');
Expand All @@ -9,28 +17,29 @@ $('.pm-star').live('mouseenter', function () {
}
});

$('.pm-star').live('mouseleave', function () {
if (!$(this).hasClass('pm-star-readonly'))
{
$(this).removeClass('pm-star-hover');
if ($(this).hasClass('pm-star-off'))
{
$(this).addClass('pm-star-on').removeClass('pm-star-off');
}
}
$( document ).on( "mouseleave", ".pm-star", function() {
if (!$(this).hasClass('pm-star-readonly'))
{
$(this).removeClass('pm-star-hover');
if ($(this).hasClass('pm-star-off'))
{
$(this).addClass('pm-star-on').removeClass('pm-star-off');
}
}
});

$('.pm-star').live('click', function () {
if (!$(this).hasClass('pm-star-readonly') || !ajaxEnabled)
{
var txt = $(this).children('a').attr('href');
ajaxSend({
url: txt,
divId: 'pagePreview'
});
$(this).toggleClass('pm-star-off');
$(this).children('a').attr('title', '')
return(false);
}
$( document ).on( "click", ".pm-star", function(e) {
if (!$(this).hasClass('pm-star-readonly') && ajaxEnabled) {
e.preventDefault();
var txt = $(this).children('a').attr('href');
ajaxSend({
url: txt,
divId: 'pagePreview'
});
$(this).toggleClass('pm-star-off');
$(this).children('a').attr('title', '');

return(false);
}
});

2 changes: 2 additions & 0 deletions modules/pm/lang/pm.en.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
$Ls['Privatemessages'] = "new private messages,new private message";
$L['pm_replyto'] = 'Reply to this user';
$L['pm_sendnew'] = 'Send a new private message';
$L['pm_sendpm'] = 'Send a private message';
$L['pm_sendmessagetohint'] = 'up to 10 recipients, separated by commas';
$L['pm_sentbox'] = 'Sent-box';
$L['pm_sentboxsubtitle'] = 'Sent messages';
$L['pm_titletooshort'] = 'The title is too short or missing';
Expand Down
4 changes: 3 additions & 1 deletion modules/pm/lang/pm.ru.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
$Ls['Privatemessages'] = "новое сообщение,новых сообщения,новых сообщений";
$L['pm_replyto'] = 'Ответить данному пользователю';
$L['pm_sendnew'] = 'Создать новое сообщение';
$L['pm_sendpm'] = 'Отправить личное сообщение';
$L['pm_sendmessagetohint'] = 'до 10 получателей, разделенных запятыми';
$L['pm_sentbox'] = 'Отправленные сообщения';
$L['pm_sentboxsubtitle'] = 'Отправленные, но еще не просмотренные получателем сообщения';
$L['pm_sentboxsubtitle'] = 'Отправленные Вами личные сообщения';
$L['pm_titletooshort'] = 'Заголовок слишком короткий либо отсутствует';
$L['pm_toomanyrecipients'] = 'Ошибка: количество получателей не должно превышать %1\$s';
$L['pm_wrongname'] = 'Ошибка в имени одного или более получателей: имя удалено из списка получателей';
Expand Down
2 changes: 1 addition & 1 deletion modules/pm/pm.header.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@

if ($cfg['pm']['css'] && $env['ext'] == 'pm')
{
cot_rc_link_file($cfg['modules_dir'] . '/pm/tpl/pm.css');
Resources::linkFile($cfg['modules_dir'] . '/pm/tpl/pm.css');
}
121 changes: 60 additions & 61 deletions modules/pm/tpl/pm.list.tpl
Original file line number Diff line number Diff line change
@@ -1,72 +1,71 @@
<!-- BEGIN: MAIN -->

<!-- BEGIN: BEFORE_AJAX -->
<div id="ajaxBlock">
<div id="ajaxBlock">
<!-- END: BEFORE_AJAX -->

<div class="block">
<h2 class="comments">{PM_PAGETITLE}</h2>
<p class="small">{PM_SUBTITLE}</p>
<p class="paging">
{PM_INBOX}<span class="spaced">{PHP.cfg.separator}</span>{PM_SENTBOX}<span class="spaced">{PHP.cfg.separator}</span>{PM_SENDNEWPM}<br />
{PHP.L.Filter}: {PM_FILTER_UNREAD}, {PM_FILTER_STARRED}, {PM_FILTER_ALL}
</p>
<form action="{PM_FORM_UPDATE}" method="post" name="update" id="update" class="ajax">
<table class="cells">
<tr>
<td class="coltop width5">
<!-- IF {PHP.cfg.jquery} --><input class="checkbox" type="checkbox" value="{PHP.themelang.pm.Selectall}/{PHP.themelang.pm.Unselectall}" onclick="$('.checkbox').attr('checked', this.checked);" /><!-- ENDIF -->
</td>
<td class="coltop width5">{PHP.L.Status}</td>
<td class="coltop width5">
<div class="pm-star pm-star-readonly">
<a href="#" title ="{PHP.L.pm_starred}"> &nbsp; </a>
</div>
</td>
<td class="coltop width40">{PHP.L.Subject}</td>
<td class="coltop width15">{PM_SENT_TYPE}</td>
<td class="coltop width15">{PHP.L.Date}</td>
<td class="coltop width15">{PHP.L.Action}</td>
</tr>
<!-- BEGIN: PM_ROW -->
<tr>
<td class="centerall {PM_ROW_ODDEVEN}"><input type="checkbox" class="checkbox" name="msg[{PM_ROW_ID}]" /></td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_ICON_STATUS}</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_STAR}</td>
<td class="{PM_ROW_ODDEVEN}">
<p class="strong">{PM_ROW_TITLE}</p>
<p class="small">{PM_ROW_DESC}</p>
</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_USER_NAME}</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_DATE}</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_ICON_EDIT} {PM_ROW_ICON_DELETE}</td>
</tr>
<!-- END: PM_ROW -->
<!-- BEGIN: PM_ROW_EMPTY -->
<tr>
<td class="centerall" colspan="7">{PHP.L.None}</td>
</tr>
<!-- END: PM_ROW_EMPTY -->
</table>
<!-- IF {PHP.jj} > 0 -->
<p class="paging">
<span class="strong">{PHP.L.pm_selected}:</span>
<select name="action" size="1">
<option value="delete" >{PHP.L.Delete}</option>
<option value="star" selected="selected">{PHP.L.pm_putinstarred}</option>
</select>
<button type="submit" name="delete">{PHP.L.Confirm}</button>
</p>
<p class="paging">{PM_PAGEPREV}{PM_PAGES}{PM_PAGENEXT}</p>
<!-- ENDIF -->
</form>
</div>
<!-- IF {PHP.cfg.jquery} AND {PHP.cfg.pm.turnajax} -->
<script type="text/javascript" src="{PHP.cfg.modules_dir}/pm/js/pm.js"></script>
<div class="block">
<h2 class="comments">{PM_PAGETITLE}</h2>
<p class="small">{PM_SUBTITLE}</p>
<p class="paging">
{PM_INBOX}<span class="spaced">{PHP.cfg.separator}</span>{PM_SENTBOX}<span class="spaced">{PHP.cfg.separator}</span>{PM_SENDNEWPM}<br />
{PHP.L.Filter}: {PM_FILTER_UNREAD}, {PM_FILTER_STARRED}, {PM_FILTER_ALL}
</p>
<form action="{PM_FORM_UPDATE}" method="post" name="update" id="update" class="ajax">
<table class="cells">
<tr>
<td class="coltop width5">
<!-- IF {PHP.cfg.jquery} -->
<input class="checkbox" type="checkbox" value="{PHP.themelang.pm.Selectall}/{PHP.themelang.pm.Unselectall}" onclick="$('.checkbox').attr('checked', this.checked);" />
<!-- ENDIF -->
</td>
<td class="coltop width5">{PHP.L.Status}</td>
<td class="coltop width5">
<div class="pm-star pm-star-readonly">
<a href="#" title ="{PHP.L.pm_starred}"> &nbsp; </a>
</div>
</td>
<td class="coltop width40">{PHP.L.Subject}</td>
<td class="coltop width15">{PM_SENT_TYPE}</td>
<td class="coltop width15">{PHP.L.Date}</td>
<td class="coltop width15">{PHP.L.Action}</td>
</tr>
<!-- BEGIN: PM_ROW -->
<tr>
<td class="centerall {PM_ROW_ODDEVEN}"><input type="checkbox" class="checkbox" name="msg[{PM_ROW_ID}]" /></td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_ICON_STATUS}</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_STAR}</td>
<td class="{PM_ROW_ODDEVEN}">
<p class="strong">{PM_ROW_TITLE}</p>
<p class="small">{PM_ROW_DESC}</p>
</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_USER_NAME}</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_DATE}</td>
<td class="centerall {PM_ROW_ODDEVEN}">{PM_ROW_ICON_EDIT} {PM_ROW_ICON_DELETE}</td>
</tr>
<!-- END: PM_ROW -->
<!-- BEGIN: PM_ROW_EMPTY -->
<tr>
<td class="centerall" colspan="7">{PHP.L.None}</td>
</tr>
<!-- END: PM_ROW_EMPTY -->
</table>
<!-- IF {PHP.jj} > 0 -->
<p class="paging">
<span class="strong">{PHP.L.pm_selected}:</span>
<select name="action" size="1">
<option value="delete" >{PHP.L.Delete}</option>
<option value="star" selected="selected">{PHP.L.pm_putinstarred}</option>
</select>
<button type="submit" name="delete">{PHP.L.Confirm}</button>
</p>
<p class="paging">{PM_PAGEPREV}{PM_PAGES}{PM_PAGENEXT}</p>
<!-- ENDIF -->
</form>
</div>

<!-- BEGIN: AFTER_AJAX -->
</div>
</div>
<!-- END: AFTER_AJAX -->

<!-- END: MAIN -->
Loading

0 comments on commit 3e30528

Please sign in to comment.