Permalink
Browse files

Added sort tabs for Questions and Answers

git-svn-id: svn://localhost/home/vnwkrepos/trunk@430 46499d64-588c-4cb2-b276-432f5e434212
  • Loading branch information...
1 parent 1b4f161 commit ba5b8f3397dddab0d82734bf1ddcfe1565277602 trung committed Mar 11, 2011
Showing with 156 additions and 102 deletions.
  1. +1 −1 core/classes/User.php
  2. +14 −14 css/integrated.css
  3. +4 −7 jobs.php
  4. +91 −56 listquestion.php
  5. +1 −1 pic_banner.php
  6. +19 −6 q_a_all_body.php
  7. +2 −2 requests/QandA.php
  8. +1 −8 sbody.php
  9. +1 −1 view_about.php
  10. +22 −6 viewallq_a.php
View
2 core/classes/User.php
@@ -284,4 +284,4 @@ public static function updateTimeLogin($id){
}
}
$user_info = new User;
-?>
+?>
View
28 css/integrated.css
@@ -24,6 +24,8 @@ html, body {
height: 100%;
}
+.highlighted {background: #ff7;}
+
#grandWrapper {
position: absolute;
height: auto !important;
@@ -562,18 +564,11 @@ a.linksmall:hover {
border-bottom: #000000 1px solid;
}
-.index_des a.linksmall{
- color: #0645AD;
- font-family: Arial, Helvetica, serif;
- font-size:12px;
- text-decoration:none;
-}
-
.index_active {
width: 160px;
}
-.index_active .linksmall{
+.index_des a.linksmall, .index_active .linksmall{
color: #333;
font-family: Arial, Helvetica, serif;
font-size: 12px;
@@ -1247,7 +1242,7 @@ div.demo-description {
#reviewLowerBound,#FillEmailDialog,#commentDialog,#EmailComment1,#editloginDialog,#confirm,#deleteConfirmDialog{
visibility:hidden;
}
-#restoreConfirmDialog,#rej_confirm,#sendmail,#photoUploadDialog,.index_des,#resetDialog,#questionDialog,#answerDialog{
+#restoreConfirmDialog,#rej_confirm,#sendmail,#photoUploadDialog, #resetDialog,#questionDialog,#answerDialog{
visibility:hidden;
}
.des{
@@ -1282,9 +1277,15 @@ div.demo-description {
}
#view_qanda > ul > li {
- border-bottom: 1px #DDD solid;
}
+ #view_qanda img {
+ width: 30px;
+ height: 30px;
+ padding: 0 0;
+ margin-right: 5px;
+ }
+
#qanda ul li{
padding-top: 10px;
}
@@ -1300,9 +1301,6 @@ div.demo-description {
width: 170px;
margin-bottom: 10px;
}
-#qanda img{
- padding: 3px 2px 2px 0px;
-}
#view_qanda{
margin: 5px;
overflow: hidden;
@@ -1314,6 +1312,9 @@ div.demo-description {
padding-right: 3px;
margin-left: 5px;
}
+ .like_wrapper:hover {
+ background-color: #db1c00;
+ }
._like,._liked{
background:url("images/liked.gif") no-repeat;
@@ -1331,6 +1332,5 @@ div.demo-description {
line-height: 19px;
background-position: 100% 0px;
font-size:11px;
- background-color: #db1c00;
color:white;
}
View
11 jobs.php
@@ -17,13 +17,9 @@
<div id='col2'>
<table class="contentTable"><tbody><tr><td >
<h1>Recruiting</h1>
- <p>VietnamWiki group is looking for: </p>
- <ul>
- <li>Part-time travel writers.</li>
- <li>Part-time web developers.</li>
- </ul>
+ <p>VietnamWiki team are looking for: </p>
- <h2>Part-time travel writer</h2>
+ <h2>Volunteer travel writers</h2>
<img src="http://www.clker.com/cliparts/2/6/8/4/122361306154509854shokunin_backpacker_on_a_phone.svg.hi.png" style="width: 140px; height: auto; float: left; margin-right: 50px;"/>
<p>The role is to do research and to write articles about traveling information to Vietnam for the website in English. We do not require much from applicants. If you feel you have these following abilities and characteristics, please send your CV (in English) to vietnamwiki@gmail.com:</p>
<ul>
@@ -39,7 +35,7 @@
<p><strong>Important:</strong> Please indicate clearly what relevant modules you have taken in your high school, university and their marks (if available).</p>
<p>Once you send your CV (or any queries) to us, we will try our best to reply in 2 working days.</p>
-
+<?/*
<h2>Part-time web developer</h2>
<img src="http://www.wanderingsandmusings.com/wp-content/uploads/2008/08/ninja.jpg" style="width: 200px; height: auto; float: left;"/>
<p>The role is to develop the website using PHP, MySQL, Javascript and JQuery. We do not require much from applicants. If you feel you have these following abilities and characteristics, please send your CV (in English) to vietnamwiki@gmail.com:</p>
@@ -56,6 +52,7 @@
<p><strong>Important:</strong> Please indicate clearly what relevant modules you have taken in your high school, university and their marks (if available).</p>
<p>Once you send your CV (or any queries) to us, we will try our best to reply in 2 working days.</p>
+*/?>
</td><tr></tbody></table>
</div>
</td>
View
147 listquestion.php
@@ -1,4 +1,14 @@
+<style>
+div.sort {border-bottom: 1px solid #777; margin-top: 20px; border-spacing: 0; height: 17px;}
+ div.sort .tabs {float: right; border-spacing: 0; height: 19px; margin-right: 5px;}
+ div.sort .tabs span {font-size: 12px; float: left; line-height: 21px; color: #777;}
+ div.sort .tabs a {border: 1px solid #777; margin-left: 5px; line-height: 13px; font-size: 12px; text-decoration: none; padding: 2px; }
+ div.sort .tabs a.current {border-bottom: 1px solid white; font-size: 12px;}
+</style>
+
+
<div id='qanda'>
+<a class="none" href="/viewallq_a.php">
<?php
if(isset($index_name)){
if($index_name=="Overview"){
@@ -15,66 +25,91 @@
?>
<div class="head3" style="margin-left: 0px; width: 168px; max-width: 187px;padding:6px">Questions and Answers</div>
<?php }?>
-<div class="button" style="margin-top: 10px; margin-left: 35px;"><a onclick='question();' >Ask a question</a></div>
-<div style="clear: both"></div>
-<!--<div class="button" style="margin-top: 10px; float: left;"><a href="/viewallq_a.php" >View All</a></div>-->
+</a>
+<div class="button" style="margin-top: 10px; margin-left: 35px;"><a onclick='question();'>Ask a question</a></div>
<div style="clear: both"></div>
+
+
+<div class="sort">
+ <div class="tabs">
+ <span>Sorted by </span>
+ <a class="current" id="sortByTime" href="#"/>Newest</a>
+ <a id="sortByLike" href="#"/>Like</a>
+ </div>
+ <div style="clear: both"></div>
+</div>
+
+
+
<div id="view_qanda"><!-- --></div>
</div>
<script>
+GLOBAL = {
+ options: {
+ start : 0,
+ type : 2,
+ post_id : <?=(isset($post_id) && $post_id>0)? $post_id : 0?> ,
+ index_id : <?=(isset($index_id)&& $index_id>0)? $index_id : 0?>,
+ destination : <?=$destination?>,
+ num_row : 5,
+ type : 1,
+ type_view : 2
+ }
+}
+
+loadQandA = function(o) {
+ GLOBAL.options = jQuery.extend(GLOBAL.options, o || {});
+ jQuery.post("requests/QandA.php", GLOBAL.options, function(response) {
+ jQuery('#view_qanda').html(response);
+ });
+}
+
jQuery(document).ready(function(){
- load_qanda(0);
+ jQuery('#questionDialog').remove();
+ jQuery('#answerDialog').remove();
+ jQuery("#Emailquestion").remove();
+ jQuery("#sortByTime").click(function() {
+ jQuery(this).addClass("current");
+ jQuery("#sortByLike").removeClass("current");
+ loadQandA({type: 1, start: 0});
+ });
+ jQuery("#sortByLike").click(function() {
+ jQuery(this).addClass("current");
+ jQuery("#sortByTime").removeClass("current");
+ loadQandA({type: 2, start: 0});
+ });
+
+ jQuery("#sortByLike").click();
});
- function load_qanda(id){
- jQuery('#questionDialog').remove();
- jQuery('#answerDialog').remove();
- jQuery("#Emailquestion").remove();
-
- // jQuery("#Emailanswer1").remove();
- <?php
- if(isset($post_id) && $post_id>0){
- ?>
- jQuery.post("requests/QandA.php", {start:id,post_id:<?php echo $post_id;?>,index_id:<?php echo $index_id;?>,destination:<?php echo $destination;?>,num_row:5,type:1,type_view:2},
- function(response) {
- jQuery('#view_qanda').html(response);
- });
- <?php
- }
- else if(isset($index_id) && $index_id>0){
- $post_q = new PostElement;
- $row_q = $post_q->query("",$index_id);
- ?>
- jQuery.post("requests/QandA.php", {start:id,post_id:<?php echo (is_array($row_q))?$row_q[0]['post_id']:0;?>,index_id:<?php echo $index_id;?>,destination:<?php echo $dest_id;?>,num_row:5,type:1,type_view:2},
- function(response) {
- jQuery('#view_qanda').html(response);
- });
- <?php
- }
- ?>
- }
- function question(){
- jQuery('#questionDialog').css('visibility','visible').dialog('open');
- }
- function answer(id){
- jQuery('#answerDialog').css('visibility','visible').dialog('open');
- jQuery('#questionId').val(id);
- }
- function sortanswer(id,_type){
- jQuery.post("/requests/sortAnswer.php",{id_q:id,type:_type},function(response){
- if(response!="" && response!=null){
- if(_type==2)
- jQuery("#q"+id).html(response);
- else if(_type==1)
- jQuery("#l_q_"+id).html(response);
- }
- });
- }
- function like(_id,_type,_v,_sort){
- jQuery.post("/requests/like.php",{id:_id,type:_type,value:_v},function(response){
- if(_type==2)
- sortanswer(_sort,2);
- else if(_type==1)
- sortanswer(_sort,1);
- });
- }
+
+
+function question(){
+ jQuery('#questionDialog').css('visibility','visible').dialog('open');
+}
+
+
+function answer(id){
+ jQuery('#answerDialog').css('visibility','visible').dialog('open');
+ jQuery('#questionId').val(id);
+}
+
+
+function sortanswer(id,_type){
+ jQuery.post("/requests/sortAnswer.php",{id_q:id,type:_type}, function(response){
+ if(response!="" && response!=null){
+ if(_type==2)
+ jQuery("#q"+id).html(response);
+ else if(_type==1)
+ jQuery("#l_q_"+id).html(response);
+ }
+ });
+}
+function like(_id,_type,_v,_sort){
+ jQuery.post("/requests/like.php",{id:_id,type:_type,value:_v},function(response){
+ if(_type==2)
+ sortanswer(_sort,2);
+ else if(_type==1)
+ sortanswer(_sort,1);
+ });
+}
</script>
View
2 pic_banner.php
@@ -1,7 +1,7 @@
<div style="line-height:0px; padding-bottom:1px;" id="image_text">
<a href="http://www.vietnamwiki.net/Vietnam_general-Holiday-Tet_festivities_welcome_spring_integration-P21">
<!--[if IE]> <img style="width:100%; height:auto;" src="/images/lunar_new_year_Tet.jpg"/> <![endif]-->
- <!--[if !IE]>--><img style="width: 100%; auto;" src="/images/lunar_new_year_Tet.jpg"/> <!--<![endif]-->
+ <!--[if !IE]>--><img style="width: 100%; auto;" src="http://www.vietnamwiki.net/images/lunar_new_year_Tet.jpg"/> <!--<![endif]-->
</a>
<div id="text_notification"></div>
</div>
View
25 q_a_all_body.php
@@ -31,6 +31,7 @@ function checkLike($id,$type){
$num_row = 10;
+
switch($type_sort){
case 1:{
$q_s = Mem::$memcache->get("ques");
@@ -78,10 +79,18 @@ function checkLike($id,$type){
$like_str_q = "<span class='like_wrapper'><a style='cursor: pointer;' onclick='like($v[id],1,$v[like_q],$v[id]);' id='like_q_$v[id]'><span id='like_num_$v[id]' class='_like'>$v[like_q]</span></a></span> &nbsp;&nbsp;";
}
- echo "<li><div class='question' id='l_q_$v[id]'><img src='".$v['avatar']."' height=30 width=30 align='left'/>$v[name]: ".$v['content']."&nbsp;&nbsp;<a style='cursor: pointer; color: #DB1C00;text-decoration: underline;' onclick='answer($v[id]);' >reply</a> $like_str_q</div>";
-
+
+ //echo "<li><div class='question' id='l_q_$v[id]'><img src='".$v['avatar']."' align='left'/>$v[name] ".$v['content']."&nbsp;&nbsp;<a style='cursor: pointer; color: #DB1C00;text-decoration: underline;' onclick='answer($v[id]);' >reply</a> $like_str_q</div>";
+ ?>
+ <li>
+ <div class='question' id='l_q_<?=$v["id"]?>'>
+ <img src="<?=$v['avatar']?>" align="left"/>
+ <?=$v["name"]?> <?=$v["content"]?> &nbsp;&nbsp;<a style='cursor: pointer; color: #DB1C00;text-decoration: underline;' onclick="answer(<?=$v["id"]?>);">reply</a><?=$like_str_q?><br/>
+ <div style="clear: both"></div>
+ </div>
+ <?
if(is_array($a_r)){
- echo "<ul id='q$v[id]'>";
+ echo "<ul id='$v[id]'>";
foreach ($a_r as $v2)
{
////////////////////////////
@@ -92,9 +101,13 @@ function checkLike($id,$type){
$like_str_a = "<span class='like_wrapper'><a style='cursor: pointer;' onclick='like($v2[id],2,$v2[like_a],$v[id]);' id='like_a_$v2[id]'><span id='like_num_a_$v2[id]' class='_like'>$v2[like_a]</span></a></span>";
}
/////////////////////////////
- if($v2['question_id']==$v['id'])
- echo "<li><img src='".$v2['avatar']."' height=30 width=30 align='left'/>$v2[name]: ".$v2["content"]." $like_str_a</li>";
-
+ if($v2['question_id']==$v['id']) {?>
+ <li class="answer">
+ <img src='<?=$v2["avatar"]?>' align='left'/>
+ <span class="content"><?=$v2["name"]?> <?=$v2["content"]?> <?=$like_str_a?></span>
+ </li>
+ <div style="clear: both"></div>
+ <?}
}
echo "</ul>";
View
4 requests/QandA.php
@@ -172,9 +172,9 @@ function checkLike($id,$type){
if($type_view == 2){
if($s>0){
?>
- <div class='prev'><a onclick="load_qanda(<?php echo $s-$row_per_page;?>);" style=" cursor: pointer; color: #CC0000; text-decoration: underline;">&laquo; Prev</a></div>
+&nbsp;&nbsp;<a onclick="loadQandA({start: <?=$s-$row_per_page;?>});" style=" cursor: pointer; color: #CC0000; text-decoration: underline;">&laquo;Prev</a>&nbsp;&nbsp;
<?php } if(($s+$row_per_page) <= $n_row) {?>
-<div class='next'><a onclick="load_qanda(<?php echo $s+$row_per_page;?>);" style=" cursor: pointer; color: #CC0000; text-decoration: underline;">&nbsp;Next &raquo;</a></div>
+ &nbsp;&nbsp;<a onclick="loadQandA({start: <?=($s+$row_per_page);?>});" style=" cursor: pointer; color: #CC0000; text-decoration: underline;">Next &raquo;</a>&nbsp;&nbsp;
<?php }?>
<?php
View
9 sbody.php
@@ -1,10 +1,3 @@
-<style>
- .highlighted{
- color:red;
- }
-</style>
-<div class="seach_body">
-<h1>Search result:</h1>
<?php
function get_value_in_text(){
return $arr = file('file.txt');
@@ -209,4 +202,4 @@ function write_link_dest($i , $c) {
}
?>
</div>
- <div class="clear_search"><!----></div>
+ <div class="clear_search"><!----></div>
View
2 view_about.php
@@ -40,7 +40,7 @@
<div class="teamProfile">
<div class="ava">
- <img width="80" height="auto" src="http://sphotos.ak.fbcdn.net/hphotos-ak-snc3/hs301.snc3/28675_407504360688_720015688_4737224_1807445_n.jpg"/>
+ <img width="80" height="auto" src="http://a8.sphotos.ak.fbcdn.net/hphotos-ak-snc4/76822_461857000688_720015688_6021789_2577618_n.jpg"/>
</div>
<div class="description">
<div class="name">Trung Huynh</div>
View
28 viewallq_a.php
@@ -29,7 +29,13 @@
text-align: left;
width: 800px;
margin-bottom: 10px;
+ background: #EEE;
+ padding: 10px;
}
+
+.anwser {
+}
+
.phantrang ul{
margin:0px;
padding: 0px;
@@ -42,6 +48,14 @@
color: #CC0000;
width: 50px;
}
+
+div.sort {border-bottom: 1px solid #777; margin-top: 20px; border-spacing: 0; height: 30px;}
+ div.sort span.header {color: #900; font-size: 20px;}
+ div.sort .tabs {float: right; border-spacing: 0; height: 31px; margin-right: 50px;}
+ div.sort .tabs span {font-size: 16px; float: left; line-height: 33px; color: #777;}
+ div.sort .tabs a {border: 1px solid #777; margin-left: 20px; line-height: 33px; font-size: 12px; text-decoration: none; padding: 5px; }
+ div.sort .tabs a.current {border-bottom: 1px solid white; font-size: 16px;}
+
</style>
<?php
/*
@@ -66,13 +80,15 @@
<div id="menuWrapper"><div id="toolbar"><?php getToolbarHTML();?></div></div>
<div id="contentTable">
<div>
- <h1>Questions and Answers</h1>
<div class="sort">
- <select id="method_sort" onchange="load_qanda(<?php echo $s;?>);">
- <option value="1" <?php if($type_sort==1) echo "selected";?> >Sort Question By Time</option>
- <option value="2" <?php if($type_sort==2) echo "selected";?> >Sort Question By Like</option>
- </select>
- </div>
+ <span class="header">Questions and Answers</span>
+ <div class="tabs">
+ <span>Sorted by </span>
+ <a class='<?=$type_sort==1? "current":""?>' href="/viewallq_a.php?s=0&type_sort=1"/>Newest</a>
+ <a class='<?=$type_sort==2? "current":""?>' href="/viewallq_a.php?s=0&type_sort=2"/>Like</a>
+ </div>
+ <div style="clear: both"></div>
+ </div>
<div id="qanda" style="width:820px !important;"><div id="view_qanda"><?php include("q_a_all_body.php");?></div></div>
</div>
</div>

0 comments on commit ba5b8f3

Please sign in to comment.