From 379b9255b237ca8bcef1d20df00b19c3ac6846d8 Mon Sep 17 00:00:00 2001 From: onli Date: Sat, 20 Jul 2013 22:47:54 +0200 Subject: [PATCH] Comment reply in backend as modal Removes the alert dialogue also from the normal popup --- include/admin/comments.inc.php | 4 +- templates/2k11/admin/comments.inc.tpl | 144 +++++++++--------- .../2k11/admin/serendipity_editor.js.tpl | 20 ++- 3 files changed, 96 insertions(+), 72 deletions(-) diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php index 69ac4da7..e52f992f 100644 --- a/include/admin/comments.inc.php +++ b/include/admin/comments.inc.php @@ -61,8 +61,8 @@ if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActio $comment['parent_id'] = $serendipity['POST']['replyTo']; if (!empty($comment['comment'])) { if (serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL')) { - echo ''; - echo ''; + $data['commentReplied'] = true; + echo serendipity_smarty_show('admin/comments.inc.tpl', $data); return true; } else { $errormsg .= COMMENT_NOT_ADDED; diff --git a/templates/2k11/admin/comments.inc.tpl b/templates/2k11/admin/comments.inc.tpl index 8f97b0b4..6b2eda3a 100644 --- a/templates/2k11/admin/comments.inc.tpl +++ b/templates/2k11/admin/comments.inc.tpl @@ -1,6 +1,10 @@ {if !empty($errormsg)} {$errormsg} {/if} +{if $commentReplied} + {$CONST.COMMENT_ADDED} + +{else}

{$CONST.COMMENTS}

@@ -82,82 +86,84 @@
-{if !is_array($sql)} - {$CONST.NO_COMMENTS} + {if !is_array($sql)} + {$CONST.NO_COMMENTS} - Return to default comment list {* l18n *} -{else} -
- {$formtoken} - + Return to default comment list {* l18n *} + {else} + + {$formtoken} + -
- {if is_array($comments)} -
    - {foreach $comments AS $comment} -
  • - - {* i18n *} -
    +
    + {if is_array($comments)} +
      + {foreach $comments AS $comment} +
    • + + {* i18n *} +
      -

      {($comment.type == 'NORMAL') ? $CONST.COMMENT : (($comment.type == 'TRACKBACK') ? $CONST.TRACKBACK : $CONST.PINGBACK )} #{$comment.id} – {$CONST.IN_REPLY_TO} {$comment.title|escape} {$CONST.ON} {$comment.timestamp|@formatTime:'%b %e %Y, %H:%M'}

      +

      {($comment.type == 'NORMAL') ? $CONST.COMMENT : (($comment.type == 'TRACKBACK') ? $CONST.TRACKBACK : $CONST.PINGBACK )} #{$comment.id} – {$CONST.IN_REPLY_TO} {$comment.title|escape} {$CONST.ON} {$comment.timestamp|@formatTime:'%b %e %Y, %H:%M'}

      -
      - Comment data {* i18n *} -
      -
      {$CONST.AUTHOR}:
      -
      {$comment.author|escape|truncate:40:"…"} {$comment.action_author}
      -
      {$CONST.EMAIL}:
      -
      {if empty($comment.email)}N/A{else}{$comment.email|escape|truncate:40:"…"}{if $comment.subscribed == 'true'} ({$CONST.ACTIVE_COMMENT_SUBSCRIPTION}){/if}{/if} {$comment.action_email}
      -
      IP:
      -
      {if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {$comment.action_ip}
      -
      URL:
      -
      {if empty($comment.url)}N/A{else}{$comment.url|escape|truncate:40:"…"} {/if} {$comment.action_url}
      -
      {$CONST.REFERER}:
      -
      {if empty($comment.referer)}N/A{else}{$comment.referer|escape|truncate:40:"…"}{/if} {$comment.action_referer}
      -
      -
      +
      + Comment data {* i18n *} +
      +
      {$CONST.AUTHOR}:
      +
      {$comment.author|escape|truncate:40:"…"} {$comment.action_author}
      +
      {$CONST.EMAIL}:
      +
      {if empty($comment.email)}N/A{else}{$comment.email|escape|truncate:40:"…"}{if $comment.subscribed == 'true'} ({$CONST.ACTIVE_COMMENT_SUBSCRIPTION}){/if}{/if} {$comment.action_email}
      +
      IP:
      +
      {if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {$comment.action_ip}
      +
      URL:
      +
      {if empty($comment.url)}N/A{else}{$comment.url|escape|truncate:40:"…"} {/if} {$comment.action_url}
      +
      {$CONST.REFERER}:
      +
      {if empty($comment.referer)}N/A{else}{$comment.referer|escape|truncate:40:"…"}{/if} {$comment.action_referer}
      +
      +
      -
      {$comment.fullBody|truncate:120:"…"}
      +
      {$comment.fullBody|truncate:120:"…"}
      -
      {$comment.fullBody}
      +
      {$comment.fullBody}
      - - {$comment.action_more} -
    • - {/foreach} -
    - {/if} - {if ($page != 1 && $page <= $pages)||$page != $pages} - - {/if} -
    + {/if} + {if ($page != 1 && $page <= $pages)||$page != $pages} + + {/if} +
-
- - - -
-
+
+ + + +
+ + + {/if} {/if} diff --git a/templates/2k11/admin/serendipity_editor.js.tpl b/templates/2k11/admin/serendipity_editor.js.tpl index e6b8bdbf..438ad15c 100644 --- a/templates/2k11/admin/serendipity_editor.js.tpl +++ b/templates/2k11/admin/serendipity_editor.js.tpl @@ -558,6 +558,14 @@ window.log = function f(){ log.history = log.history || []; log.history.push(arg $('#' + id).toggleClass('multidel_selected'); } + serendipity.closeCommentPopup = function() { + {if $use_popups} + parent.self.close(); + {else} + window.parent.parent.$.magnificPopup.close(); + {/if} + } + }( window.serendipity = window.serendipity || {}, jQuery )); // Source: https://github.com/yatil/accessifyhtml5.js @@ -814,7 +822,11 @@ var AccessifyHTML5 = function (defaults, more_fixes) { $('.comments_reply').click(function(e) { e.preventDefault(); - window.open(this.href, 'CommentForm', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1').focus(); + {if $use_popups} + window.open(this.href, 'CommentForm', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1').focus(); + {else} + $(this).magnificPopup({ type:'iframe' }); + {/if} }); $('.comments_multidelete').click(function() { @@ -987,6 +999,12 @@ var AccessifyHTML5 = function (defaults, more_fixes) { $('.media_pane .pagination').clone().prependTo('.media_pane'); $('.comments_pane .pagination').clone().prependTo('.comments_pane'); $('.entries_pane .pagination').clone().prependTo('.entries_pane'); + + if ($('body').has('#comment_replied').size() > 0) { + $('#comment_replied').click(function() { + serendipity.closeCommentPopup(); + }); + } // Equal Heights