phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Source for file _comment.form.php

Documentation is available at _comment.form.php

  1. <?php
  2. /**
  3.  * This file implements the Comment form.
  4.  *
  5.  * This file is part of the Quam Plures project - {@link http://quamplures.net/}.
  6.  * See also {@link https://launchpad.net/quam-plures}.
  7.  *
  8.  * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
  9.  * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}.
  10.  *
  11.  * @license http://quamplures.net/license.html GNU General Public License (GPL)
  12.  *
  13.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  14.  * @author fplanque: Francois PLANQUE
  15.  *
  16.  * @package pond
  17.  */
  18. if!defined('QP_MAIN_INIT') ) die'Please, do not access this page directly.' );
  19.  
  20. /**
  21.  * @var Blog 
  22.  */
  23. global $Blog;
  24. /**
  25.  * @var Comment 
  26.  */
  27. global $edited_Comment;
  28. /**
  29.  *
  30.  */
  31. global $Plugins;
  32.  
  33. global $comments_use_autobr$mode$month$tab$redirect_to;
  34.  
  35. $Form new FormNULL'comment_checkchanges''post' );
  36.  
  37. $Form->global_iconT_('Cancel editing!')'close'str_replace'&''&amp;'$redirect_to)T_('cancel')4);
  38.  
  39. $Form->begin_form'eform' );
  40.  
  41. $Form->hidden'ctrl''comments' );
  42. $Form->hidden'action''update' );
  43. $Form->hidden'redirect_to'$redirect_to );
  44. $Form->hidden'comment_ID'$edited_Comment->ID );
  45. ?>
  46.  
  47. <div class="clear"></div>
  48.  
  49. <div class="left_col">
  50.  
  51.  
  52.     <?php
  53.     $Form->begin_fieldsetT_('Comment contents') );
  54.  
  55.     echo '<table cellspacing="0" class="compose_layout">';
  56.  
  57.     echo '<tr><td width="1%"><strong>'.T_('In response to').':</strong></td>';
  58.     echo '<td class="input">';
  59.     $comment_Item $edited_Comment->get_Item();
  60.     // display and link item title
  61.     $comment_Item->titlearray(
  62.             'link_type' => 'admin_view',
  63.         ) );
  64.     echo '</td></tr>';
  65.  
  66.     if$edited_Comment->get_author_User() )
  67.     // This is not a member comment
  68.         $Form->switch_layout'none' );
  69.  
  70.         echo '<tr><td width="1%"><strong>'.T_('Author').':</strong></td>';
  71.         echo '<td class="input">';
  72.         $Form->text_input'newcomment_author'$edited_Comment->author20''''array('maxlength'=>100'style'=>'width: 100%;') );
  73.         echo '</td></tr>';
  74.  
  75.         echo '<tr><td width="1%"><strong>'.T_('Email').':</strong></td>';
  76.         echo '<td class="input">';
  77.         $Form->text_input'newcomment_author_email'$edited_Comment->author_email20''''array('maxlength'=>100'style'=>'width: 100%;') );
  78.         echo '</td></tr>';
  79.  
  80.         echo '<tr><td width="1%"><strong>'.T_('Website URL').':</strong></td>';
  81.         echo '<td class="input">';
  82.         $Form->text_input'newcomment_author_url'$edited_Comment->author_url20''''array('maxlength'=>100'style'=>'width: 100%;') );
  83.         echo '</td></tr>';
  84.  
  85.         $Form->switch_layoutNULL );
  86.     }
  87.     else
  88.     {
  89.         echo '<tr><td width="1%"><strong>'.T_('Author').':</strong></td>';
  90.         echo '<td class="input">';
  91.         // display comment author's name
  92.         $edited_Comment->authorarray() );
  93.         echo '</td></tr>';
  94.     }
  95.  
  96.     echo '</table>';
  97.     ?>
  98.  
  99. <div class="edit_toolbars">
  100. <?php
  101. // spark the plugin manager
  102. $Plugins->trigger_event'AdminDisplayToolbarAbove'array(
  103.     'target_type' => 'Comment',
  104. ) );
  105. ?>
  106. </div>
  107.  
  108.     <?php // ---------------------------- TEXTAREA -------------------------------------
  109.     $content $edited_Comment->content;
  110.     if$comments_use_autobr == 'always' || $comments_use_autobr == 'opt-out' )
  111.     {
  112.         $content unautobrize($content);
  113.     }
  114.  
  115.     $Form->fieldstart '<div class="edit_area">';
  116.     $Form->fieldend "</div>\n";
  117.     $Form->textarea'content'$content16''''40 '' );
  118.     $Form->fieldstart '<div class="tile">';
  119.     $Form->fieldend '</div>';
  120.     ?>
  121.     <script type="text/javascript">
  122.         <!--
  123.         // This is for toolbar plugins
  124.         var app_Canvas = document.getElementById('content');
  125.         //-->
  126.     </script>
  127.  
  128. <div class="edit_toolbars">
  129. <?php
  130. // spark the plugin manager
  131. $Plugins->trigger_event'AdminDisplayToolbarBelow'array(
  132.     'target_type' => 'Comment',
  133. ) );
  134. ?>
  135. </div>
  136.  
  137.     <div class="edit_actions">
  138.     <input type="submit" value="<?php /* TRANS: This is the value of an input submit button */ echo T_('Save !')?>" class="SaveButton" tabindex="10" />
  139.     <?php
  140.     // ---------- DELETE ----------
  141.     if$action == 'editcomment' )
  142.     {
  143.         // display a link to delete a comment
  144.         $edited_Comment->delete_linkarray(
  145.             'class' => 'DeleteButton',
  146.         ) );
  147.     }
  148.  
  149.     // spark the plugin manager
  150.     $Plugins->trigger_event'AdminDisplayEditorButton'array(
  151.         'target_type' => 'Comment',
  152.     ) );
  153.     ?>
  154.     </div>
  155.  
  156.     <?php
  157.     $Form->end_fieldset();
  158.  
  159.     $Form->begin_fieldsetT_('Advanced properties') );
  160.  
  161.      $Form->switch_layout'linespan' );
  162.  
  163.     if$current_User->check_perm'edit_timestamp' ) )
  164.     {    // ------------------------------------ TIME STAMP -------------------------------------
  165.         echo '<div id="itemform_edit_timestamp">';
  166.         $Form->date'comment_issue_date'$edited_Comment->dateT_('Comment date') );
  167.         echo ' '// allow wrapping!
  168.         $Form->time'comment_issue_time'$edited_Comment->date'' );
  169.         echo '</div>';
  170.     }
  171.  
  172.     // --------------------------- AUTOBR --------------------------------------
  173.     // fp> TODO: this should be Auto-P and handled by the Auto-P plugin
  174.     ?>
  175.     <input type="checkbox" class="checkbox" name="post_autobr" value="1"
  176.     <?php    if$comments_use_autobr == 'always' || $comments_use_autobr == 'opt-out' echo ' checked="checked"' ?>
  177.         id="autobr" tabindex="6" />
  178.     <label for="autobr"><strong><?php echo T_('Auto-BR'?></strong></label>
  179.  
  180.     <?php
  181.  
  182.     $Form->switch_layoutNULL );
  183.  
  184.     $Form->end_fieldset();
  185.  
  186.     // ####################### PLUGIN FIELDSETS #########################
  187.     // spark the plugin manager
  188.     $Plugins->trigger_event'AdminDispCommentFormField'array(
  189.         'Form' => $Form,
  190.         'Comment' => $edited_Comment,
  191.     ) );
  192.     ?>
  193.  
  194. </div>
  195.  
  196. <div class="right_col">
  197.  
  198. <div class="edit_toolbars">
  199. <?php
  200. // spark the plugin manager
  201. $Plugins->trigger_event'AdminDisplayToolbarSidebar'array(
  202.     'target_type' => 'Comment',
  203. ) );
  204. ?>
  205. </div>
  206.  
  207. <?php
  208.     if$Blog->get_setting('allow_rating'!= 'never'
  209.         || !empty$edited_Comment->rating ) )
  210.     {    // Rating is editable
  211.         $Form->begin_fieldsetT_('Rating') );
  212.  
  213.         // display options to rate a comment
  214.         $edited_Comment->rating_inputarray(
  215.             'before' => '<p>',
  216.             'after' => '</p>',
  217.         ) );
  218.  
  219.         // display option to reset rating
  220.         $edited_Comment->rating_none_inputarray(
  221.             'before' => '<p>',
  222.             'after' => '</p>',
  223.         ) );
  224.  
  225.          $Form->end_fieldset();
  226.     }
  227.     else
  228.     {
  229.         $Form->hidden'comment_rating');
  230.     }
  231.  
  232.         /*
  233.         $Form->begin_fieldset( T_('Properties') );
  234.             echo '<p>';
  235.             $Form->checkbox_basic_input( 'comment_featured', $edited_Comment->featured, T_('Featured') );
  236.             echo '</p>';
  237.         $Form->end_fieldset();
  238.         */
  239.  
  240.         $Form->begin_fieldsetT_('Visibility')array'id' => 'commentform_visibility' ) );
  241.  
  242.         $sharing_options[array'published'T_('Published (Public)') );
  243.         $sharing_options[array'draft'T_('Draft (Not published!)') );
  244.         $sharing_options[array'deprecated'T_('Deprecated (Not published!)') );
  245.         $Form->radio'comment_status'$edited_Comment->status$sharing_options''true );
  246.  
  247.         $Form->end_fieldset();
  248.  
  249.         $Form->begin_fieldsetT_('Links') );
  250.             echo '<p>';
  251.             $Form->checkbox_basic_input'comment_nofollow'$edited_Comment->nofollowT_('Nofollow website URL') );
  252.             // TODO: apply to all links  -- note: see basic antispam plugin that does this for x hours
  253.             echo '</p>';
  254.         $Form->end_fieldset();
  255.  
  256.         $Form->begin_fieldsetT_('Feedback info') );
  257.     ?>
  258.  
  259.     <p><strong><?php echo T_('Type'?>:</strong> <?php echo $edited_Comment->type?></p>
  260.     <p><strong><?php echo T_('IP address'?>:</strong> <?php
  261.         // Display IP address and allow plugins to filter it, e.g. the DNSBL plugin will add a link to check the IP:
  262.         echo $Plugins->get_trigger_event'FilterIpAddress'array('format'=>'htmlbody''data'=>$edited_Comment->author_IP)'data' )?></p>
  263.     <p><strong><?php echo T_('Spam Karma'?>:</strong> <?php $edited_Comment->spam_karma()?></p>
  264.  
  265.     <?php
  266.         $Form->end_fieldset();
  267.     ?>
  268. </div>
  269.  
  270. <div class="clear"></div>
  271.  
  272. <?php
  273. $Form->end_form();
  274. ?>