Exemplo n.º 1
0
    /**
     * Shows the form for the 
     */
    function editComment($item_id)
    {
        global $rsgConfig, $mainframe;
        $my =& JFactory::getUser();
        /* JPATH_SITE is only there to accomodate SecurityImages for now*/
        $doc =& JFactory::getDocument();
        $doc->addScript(JURI_SITE . "/components/com_rsgallery2/lib/rsgcomments/js/client.js");
        $doc->addStyleSheet(JURI_SITE . "/components/com_rsgallery2/lib/rsgcomments/rsgcomments.css");
        if (!$rsgConfig->get('comment_allowed_public')) {
            if (!$my->id) {
                return;
            }
        }
        ?>
	<script type="text/javascript">
        function submitbutton(pressbutton) {
            var form = document.rsgcommentform;
            if (pressbutton == 'cancel') {
                form.reset();
                return;
            }
        
        // do field validation
        if (form.tname.value == "") {
            alert( '<?php 
        echo JText::_('You should enter your name');
        ?>
' );
        }
        else if (form.tcomment.value == ""){
            alert( '<?php 
        echo JText::_('No comment entered');
        ?>
' );
        }
        else{
            form.submit();
        }
        }
    </script>
    
	<form name="rsgcommentform" method="post" action="<?php 
        echo JRoute::_("index.php?option=com_rsgallery2&rsgOption=rsgComments&task=save");
        ?>
">
	<table border="0" width="100%" class="adminForm">
	<tr>
		<td colspan="2"><h2><?php 
        echo JText::_('Add Comment');
        ?>
</h2></td>
	</tr>
	<tr>
		<td><?php 
        echo JText::_('Your Name');
        ?>
:</td>
		<td><input name='tname' type='text' class='inputbox' size='40' value='<?php 
        if (!$my->username == '') {
            echo $my->username;
        }
        ?>
' /></td>
	</tr>
	<tr>
		<td><?php 
        echo JText::_('Title');
        ?>
:</td>
		<td><input name='ttitle' type='text' class='inputbox' size='40'/></td>
	</tr>
	<tr>
		<td><?php 
        echo JText::_('Comment text');
        ?>
:</td>
		<td><div class='buttoncontainer'><?php 
        rsgComments::showButtons();
        ?>
</div></td>
	</tr>
	<tr>
		<td><?php 
        rsgComments::showSmilies();
        ?>
</td>
		<td><textarea name='tcomment' class='inputbox' cols='40' rows='10'></textarea></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>
			<?php 
        //Implement security images only for
        if ($rsgConfig->get('comment_security') == 1) {
            ?>
			<img src="<?php 
            echo JRoute::_("index.php?option=com_securityimages&task=displayCaptcha");
            ?>
">  
			<br />  
			<?php 
            echo JText::_('Enter what you see in the image above:');
            ?>
<input type="text" name="securityImageRSGallery2" />  
			<?php 
        }
        ?>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td align="center">
			<input type="button" class="button" value="<?php 
        echo JText::_('COM_RSGALLERY2_POST');
        ?>
" onclick="submitbutton('save')" />
		</td>
	</tr>
	</table>
	<input type="hidden" name="item_id" value="<?php 
        echo $item_id;
        ?>
" />
	<input type="hidden" name="rsgOption" value="rsgComments" />
	<input type="hidden" name="catid" value="<?php 
        echo rsgInstance::getInt('catid', null);
        ?>
" />
	</form>
	<a name="comment2"></a>
	<?php 
    }