Jump to content

[ajax] стена в профиле


Recommended Posts

1 заходим в templates\Default\wall открыть record.tpl
ищем

  <div class="fl_l"><a href="/wall{author-id}_{rec-id}" onClick="Page.Go(this.href); return false" class="online">{date}</a></div>[privacy-comment][comments-link]<span id="fast_comm_link_{rec-id}" class="fast_comm_link"><a href="/" id="fast_link_{rec-id}" onClick="wall.open_fast_form('{rec-id}'); wall.fast_open_textarea('{rec-id}'); return false" class="comment_ico" onMouseOver="myhtml.title('{rec-id}', 'Комментировать', 'fast_link_')"></a></span>[/comments-link][/privacy-comment]

  
заменить на

  <div class="fl_l"><span onclick="wall.ajaxopen({rec-id})">{date}</span> [privacy-comment][comments-link]<span id="fast_comm_link_{rec-id}" class="fast_comm_link">&nbsp;|&nbsp; <a href="/" id="fast_link_{rec-id}" onClick="wall.open_fast_form('{rec-id}'); wall.fast_open_textarea('{rec-id}'); return false">Комментировать</a></span>[/comments-link][/privacy-comment]</div>

  
2 заходим в templates\Default\js открыть profile.js
вставить туда

	ajaxopen: function(id){
		viiBox.start();
		$.post('/index.php?go=wall&act=ajaxopen', {id: id}, function(d){
			viiBox.win('ajaxwall_box'+id+'', d);
		})
	}
}

3 заходим в system\modules открыть wall.php
ищем

like_yes

выше вставить

case "ajaxopen":
		$id = intval($_POST['id']);
		$wall = $db->super_query("SELECT id, text, author_user_id, add_date, attach, likes_num, likes_users, for_user_id FROM `".PREFIX."_wall` WHERE id = '{$id}'");
		
		$prevv = $db->super_query("SELECT id FROM `".PREFIX."_wall` WHERE `id` < '{$id}' AND for_user_id = '{$wall['for_user_id']}' ORDER BY `id` DESC LIMIT 1");
		$nextt = $db->super_query("SELECT id FROM `".PREFIX."_wall` WHERE `id` > '{$id}' AND for_user_id = '{$wall['for_user_id']}' ORDER BY `id` LIMIT 1");
		
		//$user = $db->super_query("select user_id, user_search_pref, user_photo from `users` where user_id = '{$wall['author_user_id']}'");
		//$wallnum = $db->super_query("select user_id, user_wall_num from `users` where user_id = '{$wall['author_user_id']}'");
		$tpl->load_template('wall/ajax_wall.tpl');
		if($nextt['id']){
			$tpl->set('{next}', $nextt['id']);
		} else {
			$tpl->set('{next}', '');
		}
		if($prevv['id']){
			$tpl->set('{prev}', $prevv['id']);
		} else {
			$tpl->set('{prev}', '');
		}
		
		$tpl->set('{id}', $id);
		$tpl->set('{1id}', $wallnum['user_id']);
		if(stripos($wall['likes_users'], "u{$user_id}|") !== false){
				$tpl->set('{like-js-function}', 'groups.wall_remove_like('.$wall['id'].', '.$user_id.', \'uPages\')');
			} else {
				$tpl->set('{like-js-function}', 'groups.wall_add_like('.$wall['id'].', '.$user_id.', \'uPages\')');
			}
		if($wall['likes_num']){
			$tpl->set('{likes}', $wall['likes_num']);
		} else {
			$tpl->set('{likes}', '');
		}
		$tpl->set('{rec-id}', $id);
		if($checkLang == 'Russian'){
			$tpl->set('{author}', $user['user_search_pref']);
			} else {
			$tpl->set('{author}', totranslit($user['user_search_pref']));
			}
		$tpl->set('{user-id}', $wall['author_user_id']);
		
		if($wall['attach']){
				$attach_arr = explode('||', $wall['attach']);
				$cnt_attach = 1;
				$cnt_attach_link = 1;
				$jid = 0;
				$attach_result = '';
				foreach($attach_arr as $attach_file){
					$attach_type = explode('|', $attach_file);
					
					//Фото со стены сообщества
					if($attach_type[0] == 'photo' AND file_exists(ROOT_DIR."/uploads/groups/{$wall['tell_uid']}/photos/c_{$attach_type[1]}")){
						if($cnt_attach < 2)
							$attach_result .= "<div class=\"profile_wall_attach_photo cursor_pointer page_num{$wall['id']}\" onClick=\"groups.wall_photo_view('{$wall['id']}', '{$wall['tell_uid']}', '{$attach_type[1]}', '{$cnt_attach}')\"><img id=\"photo_wall_{$wall['id']}_{$cnt_attach}\" src=\"/uploads/groups/{$wall['tell_uid']}/photos/{$attach_type[1]}\" align=\"left\" /></div>";
						else
							$attach_result .= "<img id=\"photo_wall_{$wall['id']}_{$cnt_attach}\" src=\"/uploads/groups/{$wall['tell_uid']}/photos/c_{$attach_type[1]}\" style=\"margin-top:3px;margin-right:3px\" align=\"left\" onClick=\"groups.wall_photo_view('{$wall['id']}', '{$wall['tell_uid']}', '{$attach_type[1]}', '{$cnt_attach}')\" class=\"cursor_pointer page_num{$wall['id']}\" />";
						
						$cnt_attach++;
						
						$resLinkTitle = '';
	
					//Фото со стены юзера
					} elseif($attach_type[0] == 'photo_u'){
						if($wall['tell_uid']) $attauthor_user_id = $wall['tell_uid'];
						else $attauthor_user_id = $wall['author_user_id'];

						if($attach_type[1] == 'attach' AND file_exists(ROOT_DIR."/uploads/attach/{$attauthor_user_id}/c_{$attach_type[2]}")){

							if($cnt_attach == 1)
							
								$attach_result .= "<div class=\"profile_wall_attach_photo cursor_pointer page_num{$wall['id']}\" onClick=\"groups.wall_photo_view('{$wall['id']}', '{$attauthor_user_id}', '{$attach_type[1]}', '{$cnt_attach}', 'photo_u')\"><img id=\"photo_wall_{$wall['id']}_{$cnt_attach}\" src=\"/uploads/attach/{$attauthor_user_id}/{$attach_type[2]}\" align=\"left\" /></div>";

							else
								
								$attach_result .= "<img id=\"photo_wall_{$wall['id']}_{$cnt_attach}\" src=\"/uploads/attach/{$attauthor_user_id}/c_{$attach_type[2]}\" style=\"margin-top:3px;margin-right:3px\" align=\"left\" onClick=\"groups.wall_photo_view('{$wall['id']}', '', '{$attach_type[1]}', '{$cnt_attach}')\" class=\"cursor_pointer page_num{$wall['id']}\" height=\"{$rodImHeigh}\" />";
								
							
							$cnt_attach++;

							
						} elseif(file_exists(ROOT_DIR."/uploads/users/{$attauthor_user_id}/albums/{$attach_type[2]}/c_{$attach_type[1]}")){
						
							if($cnt_attach < 2)
								$attach_result .= "<div class=\"profile_wall_attach_photo cursor_pointer page_num{$wall['id']}\" onClick=\"groups.wall_photo_view('{$wall['id']}', '{$attauthor_user_id}', '{$attach_type[1]}', '{$cnt_attach}', 'photo_u')\"><img id=\"photo_wall_{$wall['id']}_{$cnt_attach}\" src=\"/uploads/users/{$attauthor_user_id}/albums/{$attach_type[2]}/{$attach_type[1]}\" align=\"left\" /></div>";
							else
								$attach_result .= "<img id=\"photo_wall_{$wall['id']}_{$cnt_attach}\" src=\"/uploads/users/{$attauthor_user_id}/albums/{$attach_type[2]}/c_{$attach_type[1]}\" style=\"margin-top:3px;margin-right:3px\" align=\"left\" onClick=\"groups.wall_photo_view('{$wall['id']}', '{$wall['tell_uid']}', '{$attach_type[1]}', '{$cnt_attach}')\" class=\"cursor_pointer page_num{$wall['id']}\" />";
								
							$cnt_attach++;
						}
						
						$resLinkTitle = '';

					//Видео
					} elseif($attach_type[0] == 'video' AND file_exists(ROOT_DIR."/uploads/videos/{$attach_type[3]}/{$attach_type[1]}")){
						$attach_result .= "<div><a href=\"/video{$attach_type[3]}_{$attach_type[2]}\" onClick=\"videos.show({$attach_type[2]}, this.href, location.href); return false\"><img src=\"/uploads/videos/{$attach_type[3]}/{$attach_type[1]}\" style=\"margin-top:3px;margin-right:3px\" align=\"left\" /></a></div>";
						
						$resLinkTitle = '';
					//Музыка
					} elseif($attach_type[0] == 'audio'){
						$audioId = intval($attach_type[1]);
						$audioInfo = $db->super_query("SELECT artist, name, url FROM `".PREFIX."_audio` WHERE aid = '".$audioId."'");
						if($audioInfo){
							if($_GET['uid']) $appClassWidth = 'player_mini_mbar_wall_all';
							$jid++;
							$attach_result .= '<div class="audioForSize'.$wall['id'].' '.$appClassWidth.'" id="audioForSize"><div class="audio_onetrack audio_wall_onemus"><div class="audio_playic cursor_pointer fl_l" onClick="music.newStartPlay(\''.$jid.'\', '.$wall['id'].')" id="icPlay_'.$wall['id'].$jid.'"></div><div id="music_'.$wall['id'].$jid.'" data="'.$audioInfo['url'].'" class="fl_l" style="margin-top:-1px"><a href="/?go=search&type=5&query='.$audioInfo['artist'].'&n=1" onClick="Page.Go(this.href); return false"><b>'.stripslashes($audioInfo['artist']).'</b></a> &ndash; '.stripslashes($audioInfo['name']).'</div><div id="play_time'.$wall['id'].$jid.'" class="color777 fl_r no_display" style="margin-top:2px;margin-right:5px">00:00</div><div class="player_mini_mbar fl_l no_display player_mini_mbar_wall '.$appClassWidth.'" id="ppbarPro'.$wall['id'].$jid.'"></div></div></div>';
						}
						
						$resLinkTitle = '';
					//Смайлик
					} elseif($attach_type[0] == 'smile' AND file_exists(ROOT_DIR."/uploads/smiles/{$attach_type[1]}")){
						$attach_result .= '<img src=\"/uploads/smiles/'.$attach_type[1].'\" style="margin-right:5px" />';

						$resLinkTitle = '';
						
					//Если ссылка
					} elseif($attach_type[0] == 'link' AND preg_match('/http:\/\/(.*?)+$/i', $attach_type[1]) AND $cnt_attach_link == 1){
						$count_num = count($attach_type);
						$domain_url_name = explode('/', $attach_type[1]);
						$rdomain_url_name = str_replace('http://', '', $domain_url_name[2]);
						
						$attach_type[3] = stripslashes($attach_type[3]);
						$attach_type[3] = substr($attach_type[3], 0, 200);
							
						$attach_type[2] = stripslashes($attach_type[2]);
						$str_title = substr($attach_type[2], 0, 55);
						
						if(stripos($attach_type[4], '/uploads/attach/') === false){
							$attach_type[4] = '{theme}/images/no_ava_groups_100.gif';
							$no_img = false;
						} else
							$no_img = true;
						
						if(!$attach_type[3]) $attach_type[3] = '';
							
						if($no_img AND $attach_type[2]){
							if($wall['tell_comm']) $no_border_link = 'border:0px';
							
							$attach_result .= '<div style="margin-top:2px" class="clear"><div class="attach_link_block_ic fl_l" style="margin-top:4px;margin-left:0px"></div><div class="attach_link_block_te"><div class="fl_l">Ссылка: <a href="/away.php?url='.$attach_type[1].'" target="_blank">'.$rdomain_url_name.'</a></div></div><div class="clear"></div><div class="wall_show_block_link" style="'.$no_border_link.'"><a href="/away.php?url='.$attach_type[1].'" target="_blank"><div style="width:108px;height:80px;float:left;text-align:center"><img src="'.$attach_type[4].'" /></div></a><div class="attatch_link_title"><a href="/away.php?url='.$attach_type[1].'" target="_blank">'.$str_title.'</a></div><div style="max-height:50px;overflow:hidden">'.$attach_type[3].'</div></div></div>';

							$resLinkTitle = $attach_type[2];
							$resLinkUrl = $attach_type[1];
						} else if($attach_type[1] AND $attach_type[2]){
							$attach_result .= '<div style="margin-top:2px" class="clear"><div class="attach_link_block_ic fl_l" style="margin-top:4px;margin-left:0px"></div><div class="attach_link_block_te"><div class="fl_l">Ссылка: <a href="/away.php?url='.$attach_type[1].'" target="_blank">'.$rdomain_url_name.'</a></div></div></div><div class="clear"></div>';
							
							$resLinkTitle = $attach_type[2];
							$resLinkUrl = $attach_type[1];
						}
						
						$cnt_attach_link++;
						
					//Если документ
					} elseif($attach_type[0] == 'doc'){
					
						$doc_id = intval($attach_type[1]);
						
						$row_doc = $db->super_query("SELECT dname, dsize FROM `".PREFIX."_doc` WHERE did = '{$doc_id}'");
						
						if($row_doc){
							
							$attach_result .= '<div style="margin-top:5px;margin-bottom:5px" class="clear"><div class="doc_attach_ic fl_l" style="margin-top:4px;margin-left:0px"></div><div class="attach_link_block_te"><div class="fl_l">Файл <a href="/index.php?go=doc&act=download&did='.$doc_id.'" target="_blank" onMouseOver="myhtml.title(\''.$doc_id.$cnt_attach.$wall['id'].'\', \'<b>Размер файла: '.$row_doc['dsize'].'</b>\', \'doc_\')" id="doc_'.$doc_id.$cnt_attach.$wall['id'].'">'.$row_doc['dname'].'</a></div></div></div><div class="clear"></div>';
								
							$cnt_attach++;
						}
						
					//Если опрос
					} elseif($attach_type[0] == 'vote'){
					
						$vote_id = intval($attach_type[1]);
						
						$row_vote = $db->super_query("SELECT title, answers, answer_num FROM `".PREFIX."_votes` WHERE id = '{$vote_id}'", false, "votes/vote_{$vote_id}");
						
						if($vote_id){

							$checkMyVote = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_votes_result` WHERE user_id = '{$user_id}' AND vote_id = '{$vote_id}'", false, "votes/check{$user_id}_{$vote_id}");
							
							$row_vote['title'] = stripslashes($row_vote['title']);
							
							if(!$wall['text'])
								$wall['text'] = $row_vote['title'];

							$arr_answe_list = explode('|', stripslashes($row_vote['answers']));
							$max = $row_vote['answer_num'];
							
							$sql_answer = $db->super_query("SELECT answer, COUNT(*) AS cnt FROM `".PREFIX."_votes_result` WHERE vote_id = '{$vote_id}' GROUP BY answer", 1, "votes/vote_answer_cnt_{$vote_id}");
							$answer = array();
							foreach($sql_answer as $row_answer){
							
								$answer[$row_answer['answer']]['cnt'] = $row_answer['cnt'];
								
							}
							
							$attach_result .= "<div class=\"clear\" style=\"height:10px\"></div><div id=\"result_vote_block{$vote_id}\"><div class=\"wall_vote_title\">{$row_vote['title']}</div>";
							
							for($ai = 0; $ai < sizeof($arr_answe_list); $ai++){

								if(!$checkMyVote['cnt']){
								
									$attach_result .= "<div class=\"wall_vote_oneanswe\" onClick=\"Votes.Send({$ai}, {$vote_id})\" id=\"wall_vote_oneanswe{$ai}\"><input type=\"radio\" name=\"answer\" /><span id=\"answer_load{$ai}\">{$arr_answe_list[$ai]}</span></div>";
								
								} else {

									$num = $answer[$ai]['cnt'];

									if(!$num ) $num = 0;
									if($max != 0) $proc = (100 * $num) / $max;
									else $proc = 0;
									$proc = round($proc, 2);
									
									$attach_result .= "<div class=\"wall_vote_oneanswe cursor_default\">
									{$arr_answe_list[$ai]}<br />
									<div class=\"wall_vote_proc fl_l\"><div class=\"wall_vote_proc_bg\" style=\"width:".intval($proc)."%\"></div><div style=\"margin-top:-16px\">{$num}</div></div>
									<div class=\"fl_l\" style=\"margin-top:-1px\"><b>{$proc}%</b></div>
									</div><div class=\"clear\"></div>";
			
								}
							
							}
							
							if($row_vote['answer_num']) $answer_num_text = gram_record($row_vote['answer_num'], 'fave');
							else $answer_num_text = 'человек';
							
							if($row_vote['answer_num'] <= 1) $answer_text2 = 'Проголосовал';
							else $answer_text2 = 'Проголосовало';
								
							$attach_result .= "{$answer_text2} <b>{$row_vote['answer_num']}</b> {$answer_num_text}.<div class=\"clear\" style=\"margin-top:10px\"></div></div>";
							
						}
						
					} else
					
						$attach_result .= '';
						
				}

				if($resLinkTitle AND $wall['text'] == $resLinkUrl OR !$wall['text'])
					$wall['text'] = $resLinkTitle.$attach_result;
				else if($attach_result)
					$wall['text'] = preg_replace('`(http(?:s)?://\w+[^\s\[\]\<]+)`i', '<a href="/away.php?url=$1" target="_blank">$1</a>', $wall['text']).$attach_result;
				else
					$wall['text'] = preg_replace('`(http(?:s)?://\w+[^\s\[\]\<]+)`i', '<a href="/away.php?url=$1" target="_blank">$1</a>', $wall['text']);
			} else
				$wall['text'] = preg_replace('`(http(?:s)?://\w+[^\s\[\]\<]+)`i', '<a href="/away.php?url=$1" target="_blank">$1</a>', $wall['text']);
				
			$resLinkTitle = '';
			
			//Если это запись с "рассказать друзьям"
			if($wall['tell_uid']){
				if($wall['public'])
					$rowUserTell = $db->super_query("SELECT title, photo FROM `".PREFIX."_communities` WHERE id = '{$wall['tell_uid']}'");
				else
					$rowUserTell = $db->super_query("SELECT user_search_pref, user_photo FROM `".PREFIX."_users` WHERE user_id = '{$wall['tell_uid']}'");

				if(date('Y-m-d', $wall['tell_date']) == date('Y-m-d', $server_time))
					$dateTell = langdate('сегодня в H:i', $wall['tell_date']);
				elseif(date('Y-m-d', $wall['tell_date']) == date('Y-m-d', ($server_time-84600)))
					$dateTell = langdate('вчера в H:i', $wall['tell_date']);
				else
					$dateTell = langdate('j F Y в H:i', $wall['tell_date']);
				
				if($wall['public']){
					$rowUserTell['user_search_pref'] = stripslashes($rowUserTell['title']);
					$tell_link = 'public';
					if($rowUserTell['photo'])
						$avaTell = '/uploads/groups/'.$wall['tell_uid'].'/50_'.$rowUserTell['photo'];
					else
						$avaTell = '{theme}/images/no_ava_50.png';
				} else {
					$tell_link = 'id';
					if($rowUserTell['user_photo'])
						$avaTell = '/uploads/users/'.$wall['tell_uid'].'/50_'.$rowUserTell['user_photo'];
					else
						$avaTell = '{theme}/images/no_ava_50.png';
				}

				if($wall['tell_comm']) $border_tell_class = 'wall_repost_border'; else $border_tell_class = 'wall_repost_border2';

				$wall['text'] = <<<HTML
{$wall['tell_comm']}
<div class="{$border_tell_class}">
<div class="wall_tell_info"><div class="wall_tell_ava"><a href="/{$tell_link}{$wall['tell_uid']}" onClick="Page.Go(this.href); return false"><img src="{$avaTell}" width="30" /></a></div><div class="wall_tell_name"><a href="/{$tell_link}{$wall['tell_uid']}" onClick="Page.Go(this.href); return false"><b>{$rowUserTell['user_search_pref']}</b></a></div><div class="wall_tell_date">{$dateTell}</div></div>{$wall['text']}
<div class="clear"></div>
</div>
HTML;
			}
		$tpl->set('{text}', stripslashes($wall['text']));	
		megaDate($wall['add_date']);
		if($user['user_photo'])
				$tpl->set('{ava}', $config['home_url'].'uploads/users/'.$user['user_id'].'/50_'.$user['user_photo']);
			else
				$tpl->set('{ava}', '{theme}/images/no_ava_50.png');
		$tpl->compile('content');
		break;
		
4 заходим в templates/Default/style/ открыть style.css	
вставить туда

	/* AJAX WALL */
.wallajax_author {margin-top:-50px;margin-left:55px}
.wallajax_date {margin-left:55px;margin-top:-5px;font-size:11px}
.wallajax_text {position: relative;margin: -3px 0px 0px;overflow: auto;padding: 10px 5px 23px 7px;width:620px;}
.wallajax_author a {color:#fff;text-decoration:none;outline:none}
.wallajax_bottom {padding: 10px 5px 23px 7px;margin: -3px 0px 0px}
.wl_post_like_icon {
  background: url(/images/icons/like_widget.png?1) -25px -8px no-repeat;
  width: 11px;
  height: 9px;
  margin: 3px 4px 0;
  opacity: 0.4;
  filter: alpha(opacity=40);
}

Автор Developer.Sloopy

001805tt68xgh68668rtz6.png

[ajax] стена в профиле.zip

Edited by kphp
Link to comment
Share on other sites

  • 1 year later...
1 час назад, businesrobot сказал:

Перестала стена работать.

По скрину видно что оно работает криво. Зачем тебе оно не понимаю 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...