mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
r417
Отслеживаемые темы, мелкие правки git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@417 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
8363886ac0
commit
a66619db01
7 changed files with 258 additions and 6 deletions
|
@ -2736,20 +2736,20 @@ function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width
|
|||
$height = ($height != '') ? 'height="'. $height .'"' : '';
|
||||
$width = ($width != '') ? 'width="'. $width .'"' : '';
|
||||
|
||||
$user_avatar = '<img src="'. $bb_cfg['no_avatar'] .'" alt="" border="0" '. $height .' '. $width .'>';
|
||||
$user_avatar = '<img src="'. $bb_cfg['no_avatar'] .'" alt="" border="0" '. $height .' '. $width .'/>';
|
||||
|
||||
if ($allow_avatar)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case USER_AVATAR_UPLOAD:
|
||||
$user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '<img src="'. $bb_cfg['avatar_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'>' : '';
|
||||
$user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '<img src="'. $bb_cfg['avatar_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'/>' : '';
|
||||
break;
|
||||
case USER_AVATAR_REMOTE:
|
||||
$user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '<img src="'. $avatar .'" alt="" border="0" onload="imgFit(this, 100);" onClick="return imgFit(this, 100);" '. $height .' '. $width .'>' : '';
|
||||
$user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '<img src="'. $avatar .'" alt="" border="0" onload="imgFit(this, 100);" onClick="return imgFit(this, 100);" '. $height .' '. $width .'/>' : '';
|
||||
break;
|
||||
case USER_AVATAR_GALLERY:
|
||||
$user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '<img src="'. $bb_cfg['avatar_gallery_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'>' : '';
|
||||
$user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '<img src="'. $bb_cfg['avatar_gallery_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'/>' : '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
103
upload/includes/ucp/usercp_topic_watch.php
Normal file
103
upload/includes/ucp/usercp_topic_watch.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
if (empty($bb_cfg['topic_notify_enabled']))
|
||||
{
|
||||
bb_die($lang['DISABLED']);
|
||||
}
|
||||
|
||||
$page_cfg['use_tablesorter'] = true;
|
||||
$page_cfg['include_bbcode_js'] = true;
|
||||
$tracking_topics = get_tracks('topic');
|
||||
|
||||
$user_id = $userdata['user_id'];
|
||||
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
|
||||
$per_page = $bb_cfg['topics_per_page'];
|
||||
|
||||
if ( isset($HTTP_POST_VARS['watch_list']) )
|
||||
{
|
||||
$topic_ids = implode(",", $HTTP_POST_VARS['watch_list']);
|
||||
$sql = "DELETE FROM ". BB_TOPICS_WATCH ."
|
||||
WHERE topic_id IN(". $topic_ids .")
|
||||
AND user_id = $user_id";
|
||||
if ( !($result = DB() ->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
|
||||
'S_FORM_ACTION' => BB_ROOT .'profile.php?mode=watch',
|
||||
));
|
||||
|
||||
$sql = "SELECT COUNT(topic_id) as watch_count FROM ". BB_TOPICS_WATCH ." WHERE user_id = $user_id";
|
||||
if ( !($result = DB() ->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not obtain watch topic information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
$row = DB() ->sql_fetchrow($result);
|
||||
$watch_count = ( $row['watch_count'] ) ? $row['watch_count'] : 0;
|
||||
DB() ->sql_freeresult($result);
|
||||
|
||||
if ($watch_count > 0)
|
||||
{
|
||||
$sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
|
||||
u2.user_level as last_user_level, u2.user_rank as last_user_rank
|
||||
FROM ". BB_TOPICS_WATCH ." w, ". BB_TOPICS ." t, ". BB_USERS ." u, ". BB_FORUMS ." f, ". BB_POSTS ." p, " . BB_USERS . " u2
|
||||
WHERE w.topic_id = t.topic_id
|
||||
AND t.forum_id = f.forum_id
|
||||
AND p.post_id = t.topic_last_post_id
|
||||
AND p.poster_id = u2.user_id
|
||||
AND t.topic_poster = u.user_id
|
||||
AND w.user_id = $user_id
|
||||
GROUP BY t.topic_last_post_time DESC
|
||||
LIMIT $start, $per_page";
|
||||
if ( !($result = DB() ->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not obtain watch topic information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
$watch = DB() ->sql_fetchrowset($result);
|
||||
|
||||
if ($watch)
|
||||
{
|
||||
for ( $i = 0; $i < count($watch); $i++ )
|
||||
{
|
||||
$is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
|
||||
|
||||
$template->assign_block_vars('watch', array(
|
||||
'ROW_CLASS' => ( !($i % 2) ) ? 'row1' : 'row2',
|
||||
'POST_ID' => $watch[$i]['topic_first_post_id'],
|
||||
'TOPIC_ID' => $watch[$i]['topic_id'],
|
||||
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
|
||||
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
|
||||
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
|
||||
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
|
||||
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
|
||||
'REPLIES' => $watch[$i]['topic_replies'],
|
||||
'AUTHOR' => profile_url(array('username' => $watch[$i]['username'], 'user_rank' => $watch[$i]['user_rank'])) .'</a>',
|
||||
'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) .'<br />'. profile_url(array('username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
|
||||
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
|
||||
'IS_UNREAD' => $is_unread,
|
||||
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
|
||||
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
|
||||
'PAGINATION' => generate_pagination(BB_ROOT .'profile.php?mode=watch', $watch_count, $per_page, $start),
|
||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $per_page ) + 1 ), ceil( $watch_count / $per_page )),
|
||||
'U_PER_PAGE' => BB_ROOT .'profile.php?mode=watch',
|
||||
'PER_PAGE' => $per_page,
|
||||
));
|
||||
}
|
||||
DB() ->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_refresh(BB_ROOT, '3');
|
||||
bb_die($lang['NO_WATCHED_TOPICS']);
|
||||
}
|
||||
|
||||
print_page('usercp_topic_watch.tpl');
|
||||
?>
|
|
@ -130,7 +130,8 @@ $template->assign_vars(array(
|
|||
'U_SEARCH_USER' => "search.php?search_author=1&uid={$profiledata['user_id']}",
|
||||
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&myt=1",
|
||||
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
|
||||
|
||||
'U_WATCHED_TOPICS' => "profile.php?mode=watch",
|
||||
|
||||
'S_PROFILE_ACTION' => 'profile.php',
|
||||
|
||||
'SIGNATURE' => $signature,
|
||||
|
|
|
@ -1772,6 +1772,10 @@ $lang['DEL_LIST_MY_MESSAGE'] = 'Удалить выбранные темы из
|
|||
$lang['DEL_LIST_MY_MESSAGE_INFO'] = 'После удаления и до обновления <b>всего списка</b> в нём могут быть показаны уже удаленные темы';
|
||||
$lang['DEL_LIST_INFO'] = 'Для удаления тем из списка нажмите на иконку слева от названия любого раздела';
|
||||
|
||||
//Отслеживаемые темы
|
||||
$lang['WATCHED_TOPICS'] = 'Отслеживаемые темы';
|
||||
$lang['NO_WATCHED_TOPICS'] = 'Вы не отслеживаете ни на одну из тем';
|
||||
|
||||
// set_die_append_msg
|
||||
$lang['INDEX_RETURN'] = 'Вернуться на главную';
|
||||
$lang['FORUM_RETURN'] = 'Вернуться в форум';
|
||||
|
|
|
@ -47,7 +47,13 @@ switch ($mode)
|
|||
|
||||
require(INC_DIR . 'ucp/usercp_bonus.php');
|
||||
break;
|
||||
|
||||
|
||||
case 'watch':
|
||||
if (IS_GUEST) login_redirect();
|
||||
|
||||
require(INC_DIR . 'ucp/usercp_topic_watch.php');
|
||||
break;
|
||||
|
||||
default:
|
||||
bb_die('Invalid mode');
|
||||
}
|
||||
|
|
137
upload/templates/default/usercp_topic_watch.tpl
Normal file
137
upload/templates/default/usercp_topic_watch.tpl
Normal file
|
@ -0,0 +1,137 @@
|
|||
<script type="text/javascript">
|
||||
ajax.in_edit_mode = false;
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#show-edit-btn a').click(function(){
|
||||
show_edit_options();
|
||||
$('#show-edit-btn').html( $('#edit-sel-topics').html() );
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$('td.topic_id').click(function(){
|
||||
if (!ajax.in_edit_mode) {
|
||||
$('#show-edit-btn a').click();
|
||||
$(this).find('input').click();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function show_edit_options ()
|
||||
{
|
||||
$('td.topic_id').each(function(){
|
||||
var topic_id = $(this).attr('id');
|
||||
var input = '<input id="sel-'+ topic_id +'" type="checkbox" value="'+ topic_id +'" class="topic-chbox" />';
|
||||
$(this).html(input);
|
||||
});
|
||||
|
||||
|
||||
$('input.topic-chbox').click(function(){
|
||||
if ($.browser.mozilla) {
|
||||
$('#tr-'+this.value+' td').toggleClass('hl-selected-row');
|
||||
} else {
|
||||
$('#tr-'+this.value).toggleClass('hl-selected-row');
|
||||
}
|
||||
});
|
||||
$('#pagination a.pg').each(function(){ this.href += '&mod=1'; });
|
||||
$('#ed-list-desc').hide();
|
||||
$('#mod-action-cell').append( $('#mod-action-content')[0] );
|
||||
$('#mod-action-row, #mod-action-content').show();
|
||||
|
||||
|
||||
$('#mod-action').submit(function(){
|
||||
var $form = $(this);
|
||||
$('input[name~=topic_id_list]', $form).remove();
|
||||
$('input.topic-chbox:checked').each(function(){
|
||||
$form.append('<input type="hidden" name="topic_id_list[]" value="'+ this.value +'" />');
|
||||
$('#tr-'+this.value).remove();
|
||||
});
|
||||
});
|
||||
ajax.in_edit_mode = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
td.topic_id { cursor: pointer; }
|
||||
</style>
|
||||
|
||||
<div id="mod-action-content" style="display: none;">
|
||||
<form id="mod-action" name="watch_form" method="post" action="{S_FORM_ACTION}">
|
||||
<table class="borderless pad_0" cellpadding="0" cellspacing="0">
|
||||
<tr><td class="pad_4">
|
||||
<input type="submit" name="del_from_ut" value="{L_DEL_LIST_MY_MESSAGE}" onclick="if (!window.confirm( this.value +'?' )){ return false };" />
|
||||
</tr></table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<table id="post-row" style="display: none;">
|
||||
<tr>
|
||||
<td class="row2" colspan="7">
|
||||
<div class="post_watch_wrap row1">
|
||||
<div class="post_body pad_6"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table cellpadding="2" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<h1 class="maintitle">{PAGE_TITLE}</h1>
|
||||
<div id="forums_top_links" class="nav">
|
||||
<a href="{U_INDEX}">{T_INDEX}</a> <em>·</em>
|
||||
<span id="show-edit-btn"><a href="#">{L_EDIT_MY_MESSAGE_LIST}</a></span>
|
||||
<span id="edit-sel-topics" style="display: none;"><a href="#" class="bold adm" onclick="$('input.topic-chbox').trigger('click'); return false;">{L_SELECT_INVERT}</a></span><em>·</em>
|
||||
<a href="#" class="med normal" onclick="setCookie('{COOKIE_MARK}', 'all_forums');">{L_MARK_ALL_FORUMS_READ}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="vBottom tLeft nowrap med"><b>{PAGINATION}</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" class="forumline tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="{sorter: 'text'}"></th>
|
||||
<th class="{sorter: 'text'}" width="25%"><b class="tbs-text">{L_FORUM}</b></th>
|
||||
<th class="{sorter: 'text'}" width="75%"><b class="tbs-text">{L_TOPIC}</b></th>
|
||||
<th class="{sorter: 'text'}"><b class="tbs-text">{L_AUTHOR}</b></th>
|
||||
<th width="80" class="{sorter: 'text'}"><b class="tbs-text">{L_REPLIES}</b></th>
|
||||
<th width="120" class="{sorter: 'text'} nowrap"><b class="tbs-text">{L_LASTPOST}</b></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- BEGIN watch -->
|
||||
<tr class="tCenter {watch.ROW_CLASS}" id="tr-{watch.TOPIC_ID}">
|
||||
<td id="{watch.TOPIC_ID}" class="topic_id">
|
||||
<span style="display: none;">{watch.TOPIC_ICON}</span>
|
||||
<img class="topic_icon" src="{watch.TOPIC_ICON}">
|
||||
</td>
|
||||
<td><a href="{watch.U_FORUM}" class="genmed">{watch.FORUM_TITLE}</a></td>
|
||||
<td class="tLeft nowrap">
|
||||
<a class="topictitle" title="{watch.FULL_TOPIC_TITLE}" href="{watch.U_TOPIC}">{watch.TOPIC_TITLE}</a>
|
||||
<!-- IF watch.PAGINATION --><br /><span class="topicPG"> [{ICON_GOTOPOST}{L_GOTO_SHORT} {watch.PAGINATION} ]</span><!-- ENDIF -->
|
||||
</td>
|
||||
<td>{watch.AUTHOR}</td>
|
||||
<td class="gensmall">{watch.REPLIES}</td>
|
||||
<td class="gensmall nowrap">
|
||||
{watch.LAST_POST}<!-- IF watch.IS_UNREAD --><a href="{TOPIC_URL}{watch.TOPIC_ID}{NEWEST_URL}">{ICON_NEWEST_REPLY}</a><!-- ELSE -->
|
||||
<a href="{POST_URL}{watch.LAST_POST_ID}#{watch.LAST_POST_ID}">{ICON_LATEST_REPLY}</a><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END watch -->
|
||||
<tfoot>
|
||||
<tr id="mod-action-row">
|
||||
<td colspan="6" id="mod-action-cell" class="row2">
|
||||
<span id="ed-list-desc" class="small">{L_DEL_LIST_INFO}<span class="floatR">{MATCHES}</span></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
|
|
@ -326,6 +326,7 @@ ajax.callback.gen_passkey = function(data){
|
|||
[ <a href="{U_SEARCH_USER}" class="med">{L_SEARCH_USER_POSTS}</a> ]
|
||||
[ <a href="{U_SEARCH_TOPICS}" class="med">{L_SEARCH_USER_TOPICS}</a> ]
|
||||
[ <a class="med" href="{U_SEARCH_RELEASES}">{L_SEARCH_RELEASES}</a> ]
|
||||
[ <a class="med" href="{U_WATCHED_TOPICS}">{L_WATCHED_TOPICS}</a> ]
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue