Location: PHPKode > projects > injooosm > components/com_injooosm/views/files/tmpl/form.php
<?php
/**
 * Joomla! 1.5 component injooosm
 *
 * @version $Id: form.php 2009-11-22 14:03:00$
 * @author Christian Knorr
 * @package injooosm
 * @subpackage frontend
 * @license GNU/GPL
 * @filesource
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

if(isset($this->id)) {
    $description = $this->track->description;
    $button = "submitbutton('update')";
    $title = JText::_('OSM_UPDATE');
} else {
    $description = "";
    $button = "submitbutton('save')";
    $title = JText::_('OSM_NEW_TRACK');
}

// $cfg = injooosmHelper::getConfig();
$user =& JFactory::getUser();
$juser = new JUser($user->id);

?>
<script language="javascript" type="text/javascript">

function submitbutton(pressbutton)
{
	var form = document.adminForm;
	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}
    // do field validation
	if (document.getElementById('title').value == ""){
		alert( "<?php echo JText::_( 'OSM_NEED_TITLE', true ); ?>" );
    }  
    <?php if($this->cfg->terms == 1)  { ?>
        else if (document.getElementById('terms').checked == false) {
            alert( "<?php echo JText::_( 'OSM_NEED_TERMS', true ); ?>" );
        } else {
		submitform( pressbutton );
        }
        <?php } else { ?>
         else {
            submitform( pressbutton);
        }
        <?php } ?>

}
</script>
<?php echo $this->lh;
if( ($user->get('id')) AND ($juser->get('gid') >= $this->cfg->gid ) OR (isset($this->id)) ){

?>
<div class="componentheading"><?php echo $title; ?></div>
<div>
<form name="adminForm" id="adminForm" method="post" enctype="multipart/form-data" action="<?php echo JRoute::_($this->action); ?>">
    <table width="100%">
        <tbody>
            <tr>
                <td><?php echo JText::_('OSM_TITLE'); ?>*</td>
                <td><input id="title" type="text" name="title" value="<?php if(isset($this->id)) echo $this->track->title; ?>" size="30" /></td>
            </tr>
            <tr>
                <td><?php echo JText::_('OSM_LEVEL'); ?>* <?php echo JHTML::tooltip(JText::_('OSM_TT_LEVEL'), JText::_('OSM_TT_HEADER'),'tooltip.png'); ?></td>
                <td><select name="level">
                        <option><?php echo JText::_('OSM_SELECT'); ?></option>
                        <option value="1" <?php if(isset($this->id) && $this->track->level == 1): echo "selected='selected'"; endif; ?> >1</option>
                        <option value="2" <?php if(isset($this->id) && $this->track->level == 2): echo "selected='selected'"; endif; ?> >2</option>
                        <option value="3" <?php if(isset($this->id) && $this->track->level == 3): echo "selected='selected'"; endif; ?> >3</option>
                        <option value="4" <?php if(isset($this->id) && $this->track->level == 4): echo "selected='selected'"; endif; ?> >4</option>
                        <option value="5" <?php if(isset($this->id) && $this->track->level == 5): echo "selected='selected'"; endif; ?> >5</option>
                    </select></td>
            </tr>
            <tr>
                <td><?php echo JText::_('OSM_CAT'); ?></td>
                <td><?php echo $this->lists['content']; ?></td>
            </tr>
            <?php
            if($this->cfg->access == 1)  {
            ?>
            <tr>
                <td><?php echo JText::_('OSM_ACCESS_LEVEL'); ?>&nbsp;<?php echo JHTML::tooltip(JText::_('OSM_TT_ACCESS'), JText::_('OSM_TT_HEADER'),'tooltip.png'); ?></td>
                <td><?php echo $this->lists['access']; ?></td>
            </tr>
            <?php } ?>
            <?php
            if(!isset($this->id))  {
            ?>
            <tr>
                <td><?php echo JText::_('OSM_FILE'); ?>* <?php echo JHTML::tooltip(JText::_('OSM_TT_FILES'), JText::_('OSM_TT_HEADER'),'tooltip.png'); ?></td>
                <td><input type="file" name="file" value="" size="30" /></td>
            </tr>
            <?php } ?>
            <tr>
                <td><?php echo JText::_('OSM_TERRAIN'); ?> <?php echo JHTML::tooltip(JText::_('OSM_TT_TERRAIN'), JText::_('OSM_TT_HEADER'),'tooltip.png'); ?></td>
                <td><?php echo $this->lists['terrain']; ?></td>
            </tr>
            <tr>
                <td><?php echo JText::_('OSM_DESCRIPTION'); ?>* <?php echo JHTML::tooltip(JText::_('OSM_TT_DESC'), JText::_('OSM_TT_HEADER'),'tooltip.png'); ?></td>
                <td><?php echo $this->editor->display( 'description', $description , '500', '200', '15', '25', false ) ; ?></td>
            </tr>
            <tr>
                <td valign="top"><?php echo JText::_('OSM_IMAGES'); ?> (max. 10)</td>
                <td><input type="file" name="images[]" class="multi" maxlength="10"><br clear="all"/></td>
            </tr>
            <?php
            if($this->cfg->terms == 1):
            ?>
            <tr>
                <td><?php echo JText::_('OSM_TERMS'); ?></td>
                <td><input id="terms" type="checkbox" name="terms" value="" /><?php echo JText::_('OSM_AGREE'); ?> <a class="modal" href="<?php echo $this->terms; ?>" target="_blank"><?php echo JText::_('OSM_TERMS'); ?></a></td>
            </tr>
            <?php
            endif;
            ?>
        </tbody>
    </table>
    <?php
    echo JHTML::_( 'form.token' ) . "\n"; ?>
    <input type="hidden" name="option" value="com_injooosm" />
    <input type="hidden" name="controller" value="files" />
    <?php
    if(isset($this->id)) echo '<input type="hidden" name="id" value="'.$this->id.'" />';
    ?>
    <input type="hidden" name="task" value="" />
<div>
	<button class="button" type="button" onclick="<?php echo $button; ?>">
		<?php echo JText::_('Save') ?>
	</button>
	<button class="button" type="button" onclick="submitbutton('cancel')">
		<?php echo JText::_('Cancel') ?>
	</button>
</div>
</form>
</div>
<?php
} else echo JText::_('OSM_NOT_AUTH');
echo $this->footer;
Return current item: injooosm