From 11589d6f9e70fc7f79971b53a820862204b9e643 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 29 Mar 2013 15:31:03 -0700 Subject: [PATCH] Comment fixes. Problem remains with SEF Urls --- comment.php | 4 +-- .../shortcodes/batch/comment_shortcodes.php | 13 ++++++---- e107_core/shortcodes/single/user_avatar.php | 4 +-- e107_core/templates/comment_template.php | 2 +- e107_handlers/comment_class.php | 25 +++++++++++++------ e107_web/js/core/front.jquery.js | 6 +++-- 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/comment.php b/comment.php index 4abcbe6f4..e4906fe7b 100644 --- a/comment.php +++ b/comment.php @@ -113,7 +113,7 @@ if(e_AJAX_REQUEST) // TODO improve security $_SESSION['comment_author_name'] = $clean_authorname; - + $row['comment_pid'] = $pid; $row['comment_item_id'] = intval($_POST['itemid']); $row['comment_type'] = e107::getComment()->getCommentType($tp->toDB($_POST['table'],true)); $row['comment_subject'] = $tp->toDB($_POST['subject']); @@ -135,7 +135,7 @@ if(e_AJAX_REQUEST) // TODO improve security { $row['comment_id'] = $newid; - $width = ($pid) ? 5 : 0; + $width = ($pid) ? 1 : 0; $ret['html'] = "\n\n"; $ret['html'] .= e107::getComment()->render_comment($row,'comments','comment',intval($_POST['itemid']),$width); diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index 43e985c35..12890d5c9 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -74,10 +74,13 @@ class comment_shortcodes extends e_shortcode function sc_timedate($parm='') - { - global $TIMEDATE, $datestamp, $gen; - $datestamp = $gen->convert_date($this->var['comment_datestamp'], "short"); - return $datestamp; + { + if($parm == 'relative') + { + return e107::getDate()->computeLapse($this->var['comment_datestamp'],time(),false, false, 'short'); + } + + return e107::getDate()->convert_date($this->var['comment_datestamp'], "short"); } @@ -251,7 +254,7 @@ class comment_shortcodes extends e_shortcode function sc_comment_input($parm='') { $options = array( - 'class' => 'tbox input comment-input', + 'class' => 'tbox input-xxlarge comment-input', 'placeholder' => "Leave a message..." // TODO Lan ); diff --git a/e107_core/shortcodes/single/user_avatar.php b/e107_core/shortcodes/single/user_avatar.php index 873844857..b2bef75a9 100644 --- a/e107_core/shortcodes/single/user_avatar.php +++ b/e107_core/shortcodes/single/user_avatar.php @@ -42,13 +42,13 @@ function user_avatar_shortcode($parm='') if (vartrue($image)) { - $img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"aw=".$width."&ah=".$height); + $img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"w=".$width."&h=".$height); $text = " "; } else { - $img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","aw=".$width."&ah=".$height); + $img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height); $text = ""; } diff --git a/e107_core/templates/comment_template.php b/e107_core/templates/comment_template.php index a500d4e43..0fdd67221 100644 --- a/e107_core/templates/comment_template.php +++ b/e107_core/templates/comment_template.php @@ -129,7 +129,7 @@ $COMMENT_TEMPLATE['ITEM'] = '
{USERNAME}
-
{TIMEDATE}
+
{TIMEDATE=relative}
{COMMENT_STATUS}
{COMMENT_RATE} {REPLY} {COMMENTEDIT} {COMMENT_MODERATE}
diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index 3d7d2ca06..39946c64b 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -258,10 +258,12 @@ class comment // ------------------------------------------------------------- - $indent = ($action == 'reply') ? "style='margin-left:40px'" : ""; + $indent = ($action == 'reply') ? " class='offset1' " : ""; $formid = ($action == 'reply') ? "e-comment-form-reply" : "e-comment-form"; $text = "\n
\n".e107::getMessage()->render('postcomment', true, false, false);//temporary here + + // $text .= "Indent = ".$indent; $text .= "
"; $data = array( @@ -408,12 +410,12 @@ class comment if (vartrue($pref['nested_comments'])) { - $width2 = 100 - $width; - $total_width = "95%"; + // $width2 = 100 - $width; + // $total_width = "95%"; if ($width) { $renderstyle = $COMMENT_TEMPLATE['ITEM_START']; - $renderstyle .= "
".$COMMENT_TEMPLATE['ITEM']."
"; + $renderstyle .= "
".$COMMENT_TEMPLATE['ITEM']."
"; $renderstyle .= $COMMENT_TEMPLATE['ITEM_END']; } else @@ -487,9 +489,9 @@ class comment ORDER BY comment_datestamp "; $sql_nc = new db; /* a new db must be created here, for nested comment */ - if ($sub_total = $sql_nc->db_Select_gen($sub_query)) + if ($sub_total = $sql_nc->gen($sub_query)) { - while ($row1 = $sql_nc->db_Fetch()) + while ($row1 = $sql_nc->fetch()) { if($this->isPending($row1)) @@ -501,7 +503,11 @@ class comment if ($pref['nested_comments']) { - $width = min($width + 3, 80); + + // $width = min($width + 1, 80); + $width = $width+1; + // $width = $width=+1; + // $text .= "WIDTH=".$width; } $text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating); unset($width); @@ -978,6 +984,11 @@ class comment //XXX Do NOT add to template - too important to allow for modification. $text = "
    \n".$text."\n
"; } + else + { + $text = "
"; + } + $search = array("{MODERATE}","{COMMENTS}","{COMMENTFORM}","{COMMENTNAV}"); $replace = array($modcomment,$text,$comment,$pagination); $TEMPL = str_replace($search,$replace,$this->template['LAYOUT']); diff --git a/e107_web/js/core/front.jquery.js b/e107_web/js/core/front.jquery.js index 504364638..06cc59a7a 100644 --- a/e107_web/js/core/front.jquery.js +++ b/e107_web/js/core/front.jquery.js @@ -43,7 +43,7 @@ $(document).ready(function() var formid = (pid != '0') ? "#e-comment-form-reply" : "#e-comment-form"; var data = $('form'+formid).serialize() ; var total = parseInt($("#e-comment-total").text()); - + $.ajax({ type: 'POST', url: url + '?ajax_used=1&mode=submit', @@ -59,7 +59,7 @@ $(document).ready(function() if($('#comments-container').length){ // alert('true'); }else{ - $("#e-comment-form").parent().prepend("
"); + // $("#e-comment-form").parent().prepend("
"); } if(pid != 0) @@ -119,6 +119,8 @@ $(document).ready(function() url: url + '?ajax_used=1&mode=reply', data: { itemid: sp[3], table: table }, success: function(data) { + + // alert(url); var a = $.parseJSON(data); if(!a.error)