<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
?>
<div class="content_title">
    <h3><?php _e($gallery_item_title); ?></h3>
</div>
<div class="space"></div>
<div class="content_toolbar">
    <a href="index.php?<?php echo Html::xuriquery('mod_gallery_item', 'admin_list',array("ga_id"=>$gallery_id)); ?>" title=""><?php _e('Back'); ?></a>
</div>
<div class="space"></div>
<div class="status_bar">
<?php if (Notice::get('mod_gallery_item/msg')) { ?>
	<span id="adminflfrm_stat" class="status"><?php echo Notice::get('mod_gallery_item/msg'); ?></span>
<?php } ?>
</div>
<div class="space"></div>
<?php
$gi_form = new Form('index.php', 'giform', 'check_gi_info');
$gi_form->setEncType('multipart/form-data');
$gi_form->p_open('mod_gallery_item', $next_action);
?>
<table id="categorydform_table" class="form_table" cellspacing="1">
    <tfoot>
        <tr>
            <td colspan="2">
            <?php
            echo Html::input('reset', 'reset', __('Reset'));
            echo Html::input('button', 'cancel', __('Cancel'), 'onclick="window.history.go(-1);"');
            echo Html::input('submit', 'submit', __('Save'));
            echo Html::input('hidden', 'gi[gallery_id]', $gallery_id);
            echo Html::input('hidden', 'gi[id]', $gi_id);
            ?>
            </td>
        </tr>
    </tfoot>
    <tbody>
		<tr>
            <td class="label"><?php _e('Language'); ?></td>
            <td class="entry">
            <?php
            echo Toolkit::switchText($curr_gi->s_locale?$curr_gi->s_locale:$mod_locale, 
                Toolkit::toSelectArray($langs, 'locale', 'name'));
            echo Html::input('hidden', 'gi[s_locale]', 
           		$curr_gi->s_locale?$curr_gi->s_locale:$mod_locale);
            ?>
            </td>
        </tr>
        <tr>
            <td class="label"><?php _e('Title'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('text', 'gi[title]', $curr_gi->title, 
                '', $gi_form, 'RequiredTextbox', 
                __('Please input gallery title!'));
            ?>
            </td>
        </tr>
        <tr>
            <td class="label"><?php _e('Description'); ?></td>
            <td class="entry">
            <?php
            echo Html::textarea('gi[description]', $curr_gi->description, 'rows="6" cols="56"', 
            	$gi_form, 'RequiredTextbox', __('Please input description!'))
            ?>
            </td>
        </tr>
		<tr>
            <td class="label"><?php _e('Full Image'); ?></td>
            <td class="entry">
            <?php
			if($gi_id) {
			?>
			<img id="fullview" src="<?php echo $curr_gi->feature_img?>"><br />
			<script type="text/javascript" language="javascript">
			<!--
			    resizeImg(document.getElementById("fullview"), 420);
			//-->
			</script>
			<?php
				echo Html::input('file', 'gi_file', '', 
                '', $gi_form);
			}else{
				echo Html::input('file', 'gi_file', '', 
                '', $gi_form, 'RequiredTextbox', 
                __('Please select a gallery big image to upload!'));
			}
            ?>
			<BR />
			<?php _e('Supported file format'); ?>:<?php echo PIC_ALLOW_EXT;?>
			<BR />
			<?php _e('Upload size limit'); ?>:<?php echo ini_get('upload_max_filesize');?>
            </td>
        </tr>
		<tr>
            <td class="label"><?php _e('Thumbnail'); ?></td>
            <td class="entry">
            <?php
			if($gi_id) {
			?>
			<img id="thumbview" src="<?php echo $curr_gi->feature_thumb?>"><br />
			<script type="text/javascript" language="javascript">
			<!--
			    resizeImg(document.getElementById("thumbview"), 420);
			//-->
			</script>
			<?php
				echo Html::input('file', 'gi_thumb_file', '', 
                '', $gi_form);
			}else{
				echo Html::input('file', 'gi_thumb_file', '', 
                '', $gi_form, 'RequiredTextbox', 
                __('Please select a gallery small image to upload!'));
			}
            ?>
			<BR />
			<?php _e('Supported file format'); ?>:<?php echo PIC_ALLOW_EXT;?>
			<BR />
			<?php _e('Upload size limit'); ?>:<?php echo ini_get('upload_max_filesize');?>
            </td>
        </tr>
        <tr>
            <td class="label"></td>
            <td class="entry">
            <?php
            echo Html::input('checkbox', 'gi[published]', '1', 
                Toolkit::switchText($curr_gi->published, 
                    array('0' => '', '1' => 'checked="checked"')));
            ?>
            &nbsp;<?php _e('Publish'); ?>
            </td>
        </tr>
        <tr>
            <td class="label"></td>
            <td class="entry">
            <?php
            echo Html::input('checkbox', 'ismemonly', '1', 
                Toolkit::switchText(strval(ACL::isMemOnly($curr_gi->for_roles)), 
                    array('0' => '', '1' => 'checked="checked"')));
            ?>
            &nbsp;<?php _e('Member only access'); ?>
            </td>
        </tr>
    </tbody>
</table>
<?php
$gi_form->close();
$gi_form->writeValidateJs();
?>
