[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_comment/ -> admin.comment.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Comment
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  
  21  class HTML_comment {
  22  
  23      /**
  24       * @param option
  25       * @param rows - article details
  26       * @param search - search criteria
  27       * @param pageNav - page navigation status
  28       * @return list of comments.
  29       */
  30    function showComments( $option, &$rows, &$search, &$pageNav ) {
  31  
  32      # Load configuration file
  33      global $mosConfig_absolute_path, $mosConfig_live_site, $mainframe, $acl, $my;
  34      
  35    require ($mosConfig_absolute_path."/administrator/components/com_comment/config.comment.php");
  36  
  37      ?>
  38      <form action="index2.php" method="post" name="adminForm">
  39      <table class="adminheading">
  40          <tr>
  41              <th>
  42              <?php echo T_('Comment Manager'); ?>
  43              </th>
  44              <td>
  45              <?php echo T_('Filter:'); ?>
  46              </td>
  47              <td>
  48              <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
  49              </td>
  50          </tr>
  51      </table>
  52      <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
  53        <tr>
  54            <th width="20">#</th>
  55          <th width="20" class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" /></th>
  56          <th><div align="center"><?php echo T_('Author'); ?></div></th>
  57          <th><div align="left"><?php echo T_('Comments'); ?></div></th>
  58          <th><div align="center"><?php echo T_('Date'); ?></div></th>
  59          <th><div align="center"><?php echo T_('Content Item'); ?></div></th>
  60          <th><div align="center"><?php echo T_('Published'); ?></div></th>
  61        </tr>
  62        <?php
  63      $k = 0;
  64      for ($i=0, $n=count( $rows ); $i < $n; $i++) {
  65        $row = &$rows[$i];
  66        $row->article_link = 'index2.php?option=com_comment&task=editA&hidemainmenu=1&id='. $row->id;
  67        $link = 'index2.php?option=com_content&sectionid=0&task=edit&hidemainmenu=1&id='. $row->articleid;
  68  
  69        echo "<tr class='row$k'>";
  70        echo "<td width='20'>".$pageNav->rowNumber( $i )."</td>";
  71        echo "<td width='5%'><input type='checkbox' id='cb$i' name='cid[]' value='$row->id' onclick='isChecked(this.checked);' /></td>";
  72        echo "<td align='center'>$row->name</td>";
  73  
  74        if(strlen($row->comments) > $admin_comments_length) {
  75          $row->comments  = substr($row->comments,0,$admin_comments_length-3);
  76          $row->comments .= "...";
  77        }
  78  
  79        echo "<td align='left'><a href='$row->article_link'>$row->comments</td>";
  80        echo "<td align='center'>$row->startdate</td>";
  81        echo "<td align='center'><a href='$link'>$row->title</a></td>";
  82  
  83        $task = $row->published ? 'unpublish' : 'publish';
  84        $img = $row->published ? 'publish_g.png' : 'publish_x.png';
  85  
  86        ?>
  87          <td width="10%" align="center"><a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')"><img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" /></a></td>
  88      </tr>
  89      <?php    $k = 1 - $k; } ?>
  90  
  91    </table>
  92  
  93          <?php echo $pageNav->getListFooter(); ?>
  94    <input type="hidden" name="option" value="<?php echo $option;?>" />
  95    <input type="hidden" name="task" value="" />
  96    <input type="hidden" name="hidemainmenu" value="0">
  97    <input type="hidden" name="boxchecked" value="0" />
  98    </form>
  99    <?php
 100    }
 101  
 102      /**
 103       * @param option
 104       * @param rows - article id, or 0 for new comment
 105       * @param clist - article list to enable comments to be moved
 106       * @param puplist - yes/no publish selection box
 107       * @return article comments to edit/move or new article comments box
 108       */
 109    function editComment( $option, &$row, &$clist, &$puplist ) {
 110      mosMakeHtmlSafe( $row, ENT_QUOTES, 'comments' );
 111      ?>
 112  
 113      <script type="text/javascript">
 114      function submitbutton(pressbutton) {
 115        var form = document.adminForm;
 116        if (pressbutton == 'cancel') {
 117          submitform( pressbutton );
 118          return;
 119        }
 120        // validation
 121        if (form.comments.value == ""){
 122          alert( "<?php echo T_('You must add a comment') ?>" );
 123        } else if (form.articleid.value == "0"){
 124          alert( "<?php echo T_('You must select a content item.') ?>" );
 125        } else {
 126          submitform( pressbutton );
 127        }
 128      }
 129      </script>
 130  
 131      <table cellpadding="4" cellspacing="0" border="0" width="100%">
 132          <tr>
 133              <td width="100%"><span class="sectionname"><?php echo $row->id ? 'Edit' : 'Add';?> <?php echo T_('Comments'); ?></span></td>
 134          </tr>
 135      </table>
 136  
 137      <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
 138      <form action="index2.php" method="post" name="adminForm" id="adminForm">
 139        <tr>
 140          <td width="20%" align="right"><?php echo T_('Name') ;?>:</td>
 141          <td width="80%">
 142            <input class="inputbox" type="text" name="name" size="50" maxlength="30" value="<?php echo $row->name;?>" />
 143          </td>
 144        </tr>
 145  
 146        <tr>
 147          <td valign="top" align="right"><?php echo T_('Comments') ;?>:</td>
 148          <td>
 149            <textarea class="inputbox" cols="50" rows="5" name="comments"><?php echo $row->comments;?></textarea>
 150          </td>
 151        </tr>
 152  
 153        <tr>
 154          <td valign="top" align="right"><?php echo T_('Published') ;?>:</td>
 155          <td>
 156            <?php echo $puplist; ?>
 157          </td>
 158        </tr>
 159        
 160        <tr>
 161          <td valign="top" align="right"><?php echo T_('Content Item') ;?>:</td>
 162          <td>
 163            <?php echo $clist; ?>
 164          </td>
 165        </tr>
 166        
 167      </table>
 168  
 169      <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 170      <input type="hidden" name="option" value="<?php echo $option;?>" />
 171      <input type="hidden" name="task" value="" />
 172      </form>
 173    <?php
 174    }
 175  
 176  
 177  }
 178  ?>