]> git.mjollnir.org Git - s9y.git/commitdiff
Abstraction to allow live comments
authorgarvinhicking <garvinhicking>
Fri, 6 Jan 2006 17:19:22 +0000 (17:19 +0000)
committergarvinhicking <garvinhicking>
Fri, 6 Jan 2006 17:19:22 +0000 (17:19 +0000)
docs/NEWS
include/functions_comments.inc.php
include/functions_smarty.inc.php
include/genpage.inc.php
templates/default/commentform.tpl
templates/default/comments.tpl
templates/kubrick/comments.tpl

index 8eba31e2bd82287b445a84a2f35cc9d7c3c8b99d..0bf460180e4c44476596cdca53d2f7a914b0f12d 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -78,6 +78,9 @@ Version 1.0 ()
 Version 0.9.2 ()
 ------------------------------------------------------------------------
 
+   * Fix server locale order to always first use the charset locale
+     instead of a generic locale. Fixes bug #1384978 (garvinhicking)
+
    * Fix entry quicksearch on postgresql, where it returned the same
      entry multiple times if it was contained in multiple categories.
      Fix by Robert Treat, many thanks!
index 5611c3d8d7a6bbaad85bee235bcc65672fd5d79a..3003d3c6d546d2d576e3e2c3a8a1b41630452577 100644 (file)
@@ -188,7 +188,8 @@ function serendipity_generateCommentList($id, $comments = NULL, $selected = 0, $
         }
     }
 
-    $retval = $parent ? '' : '<select id="serendipity_replyTo" name="serendipity[replyTo]"><option value="0">[ ' . TOP_LEVEL . ' ]</option>';
+    $retval = $parent ? '' : '<select id="serendipity_replyTo" onchange="' . (!empty($serendipity['plugindata']['onchange']) ? $serendipity['plugindata']['onchange'] : '') . '" name="serendipity[replyTo]"><option value="0">[ ' . TOP_LEVEL . ' ]</option>';
+
     $i = 0;
     foreach ($comments as $comment) {
         if ($comment['parent_id'] == $parent) {
@@ -243,14 +244,14 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
             if (!empty($comment['url']) && substr($comment['url'], 0, 7) != 'http://' && substr($comment['url'], 0, 8) != 'https://') {
                 $comment['url'] = 'http://' . $comment['url'];
             }
-            
+
             if (!empty($comment['url'])) {
                 if (!@parse_url($comment['url'])) {
                     $comment['url'] = '';
                 }
                 $comment['url'] = htmlspecialchars($comment['url'], ENT_QUOTES);
             }
-            
+
             serendipity_plugin_api::hook_event('frontend_display', $comment);
 
             if (isset($comment['no_email']) && $comment['no_email']) {
index 006301371c44077dd6ee7a2d823387d5c304d26d..3db39daec40923d453a4d4bc85e3713acdb2353c 100644 (file)
@@ -523,7 +523,7 @@ function &serendipity_replaceSmartyVars(&$tpl_source, &$smarty) {
  * @access public
  * @return null
  */
-function serendipity_smarty_init() {
+function serendipity_smarty_init($vars = array()) {
     global $serendipity;
 
     if (!isset($serendipity['smarty'])) {
@@ -633,6 +633,10 @@ function serendipity_smarty_init() {
         )
     );
 
+    if (count($vars) > 0) {
+        $serendipity['smarty']->assign($vars);
+    }
+
     // For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
     // setup custom smarty variables, modifiers etc. to use in their templates.
     @include_once $serendipity['smarty']->config_dir . '/config.inc.php';
index da4b32a4ec7b5be5b36db48334af0987a69f8119..8e156eab21a048bd69cd67fdccb28190ffd6889e 100644 (file)
@@ -14,8 +14,9 @@ if ((empty($uri_addData['uriargs']) || trim($uri_addData['uriargs']) == $serendi
     $uri_addData['startpage'] = true;
 }
 
+$serendipity['plugindata']['smartyvars'] = array(); // Plugins can change this global variable
 serendipity_plugin_api::hook_event('genpage', $uri, $uri_addData);
-serendipity_smarty_init();
+serendipity_smarty_init($serendipity['plugindata']['smartyvars']);
 
 $serendipity['smarty']->assign(
     array(
index b00dd89324ed2e519040bd7657663614920dd528..071af1c4237ce97ddffeeb198f15472c5eccd730 100644 (file)
@@ -1,4 +1,5 @@
-<div class="serendipityCommentForm">
+<div id="serendipityCommentFormC" class="serendipityCommentForm">
+    <div id="serendipity_replyform_0"></div>
     <a id="serendipity_CommentForm"></a>
     <form id="serendipity_comment" action="{$commentform_action}#feedback" method="post">
     <div><input type="hidden" name="serendipity[entry_id]" value="{$commentform_id}" /></div>
@@ -52,7 +53,7 @@
 
        <tr>
             <td>&#160;</td>
-            <td><input type="submit" name="serendipity[submit]" value="{$CONST.SUBMIT_COMMENT}" /> <input type="submit" name="serendipity[preview]" value="{$CONST.PREVIEW}" /></td>
+            <td><input type="submit" name="serendipity[submit]" value="{$CONST.SUBMIT_COMMENT}" /> <input type="submit" id="serendipity_preview" name="serendipity[preview]" value="{$CONST.PREVIEW}" /></td>
         </tr>
     </table>
     </form>
index c3d82b0e1523e968f51811808750037884135319..e8873f3f6e0ab606f9fcfadbc43e65702391bc34 100644 (file)
@@ -1,6 +1,6 @@
 {foreach from=$comments item=comment}
     <a id="c{$comment.id}"></a>
-    <div class="serendipity_comment serendipity_comment_author_{$comment.author|@makeFilename} {if $entry.author == $comment.author}serendipity_comment_author_self{/if}" style="padding-left: {$comment.depth*20}px">
+    <div id="serendipity_comment_{$comment.id}" class="serendipity_comment serendipity_comment_author_{$comment.author|@makeFilename} {if $entry.author == $comment.author}serendipity_comment_author_self{/if}" style="padding-left: {$comment.depth*20}px">
         <div class="serendipity_commentBody">{$comment.body}</div>
         <div class="serendipity_comment_source">
             <a href="#c{$comment.id}" title="Link to comment #{$comment.trace}">#{$comment.trace}</a>
@@ -18,7 +18,8 @@
                 (<a href="{$comment.link_delete}" onclick="return confirm('{$CONST.COMMENT_DELETE_CONFIRM|@sprintf:$comment.id:$comment.author}');">delete</a>)
             {/if}
             {if $entry.allow_comments}
-                (<a href="#serendipity_CommentForm" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}';">{$CONST.REPLY}</a>)
+                (<a href="#serendipity_CommentForm" id="serendipity_reply_{$comment.id}" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}'; {$comment_onchange}">{$CONST.REPLY}</a>)
+                <div id="serendipity_replyform_{$comment.id}"></div>
             {/if}
         </div>
     </div>
index 97375e5c045ec2b4f2c3f8adab7b459f68857d33..d600f9392edf325bf460001bcb80f664a509614f 100644 (file)
@@ -6,14 +6,15 @@
             {else}
                 {$comment.author|@default:$CONST.ANONYMOUS}
             {/if}</cite> {$CONST.SAYS}:<br />
-        <div class="commentmetadata">
+        <div class="commentmetadata" id="serendipity_comment_{$comment.id}">
             <a href="#c{$comment.id}" title="{$CONST.LINK_TO_COMMENT|sprintf:$comment.trace}">#{$comment.trace}</a>
             {$comment.timestamp|@formatTime:$CONST.DATE_FORMAT_SHORT}
             {if $entry.is_entry_owner}
                 (<a href="{$comment.link_delete}" onclick="return confirm('{$CONST.COMMENT_DELETE_CONFIRM|@sprintf:$comment.id:$comment.author}');">{$CONST.DELETE}</a>)
             {/if}
             {if $entry.allow_comments}
-                (<a href="#serendipity_CommentForm" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}';">{$CONST.REPLY}</a>)
+                (<a href="#serendipity_CommentForm" id="serendipity_reply_{$comment.id}" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}'; {$comment_onchange}">{$CONST.REPLY}</a>)
+                <div id="serendipity_replyform_{$comment.id}"></div>
             {/if}
         </div>
         <p>{$comment.body}</p>