<?php
$this->load_template('_header.php');
$this->load_template('_top.php');
?>
<script type="text/javascript" src="<?php echo $C->SITE_URL?>themes/<?php echo $C->THEME ?>/js/js_dashboard.js"></script>
<div id="generalspace">
        
    <div id="container">
    
    	<div id="column1"><?php $this->load_template('_verticalmenu-dashboard.php'); ?></div>
        
        <div id="column2">

			<div id="dashboard2">
                
                <div id="listpages">
                
                	<div class="boxdash">
                
                        <div class="title"><?php echo $this->lang('dashboard_pages_title')?></div>
                        
                        <div class="spaceinfo">
                        
                        	<?php $this->load_template('__dashboard-smenu-pages.php');?>
                            
                            <div class="mrg20T mrg30B">
                            
                                <div id="formadd" class="hide">                                
                                
									<div class="editarea">
                                    
                                    	<div class="subtitle"><?php echo $this->lang('dashboard_pages_txt_createpage'); ?></div>
                    
			                            <div id="form01" class="mrg30B">
            			            		<form id="form1" name="form1" method="post" action="">
                                            <div class="mrg20T grey1"><?php echo $this->lang('dashboard_pages_txt_category')?></div>
                                            <div><select name="pagecategory" id="pagecategory" class="boxinput withbox" onchange="loadsubcategorypages(this.value, -1, '<?php echo $this->lang('dashboard_pages_txt_choosesubcategory')?>','#pagesubcategory');"></select></div>
                    
                                            <div class="mrg10T grey1"><?php echo $this->lang('dashboard_pages_txt_subcategory')?></div>
                                            <div><select name="pagesubcategory" id="pagesubcategory" class="boxinput withbox"></select></div>

                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_pages_txt_titlepage')?>:</div>
                        					<div><input name="titlepage" type="text" id="titlepage" class="boxinput withbox"/></div>
                        
                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_pages_txt_urlpage')?>:</div>
                        					<div><input name="urlpage" type="text" id="urlpage" class="boxinput withbox" /></div>

                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_pages_txt_descriptionpage')?>:</div>
                        					<div><textarea name="descriptionpage" rows="4" class="boxinput withbox" id="descriptionpage"></textarea></div>

                                            <div id="msgerror" class="redbox"></div>
                                            <div class="mrg10T mrg5B">
                                                <span><input type="submit" name="bsave" id="bsave" value="<?php echo $this->lang('dashboard_pages_txt_buttonsave')?>" class="bblue hand"/></span> <span id="lcancelf" class="mrg20L onlyblue hand"><?php echo $this->lang('dashboard_pages_txt_bcancel'); ?></span>
                                            </div>
                      
					                      </form>
                                        </div>
                                
                                    </div>
                                
                                
                                </div>
                                
                                <?php if (empty($D->htmlPages)) { ?>
                                <div id="spacelink" class="mrg50T">
                                    <div class="txtsize00 centered">
                                        <div><?php echo $this->lang('dashboard_pages_txt_nopages'); ?></div>
                                        <div class="mrg20T"><span id="linkadd" class="btn btn-orange"><?php echo $this->lang('dashboard_pages_txt_createpage'); ?></span></div>
                                    </div>
                                </div>
                                <?php } else { ?>
                                
                                <div id="spacelink" class="tright"><span id="linkadd" class="btn btn-orange mrg10R"><?php echo $this->lang('dashboard_pages_txt_createpage'); ?></span></div>
                                <div class="mrg10T"><?php echo $D->htmlPages?></div>
                                
                                <?php } ?>                            
                            
								<script>
                                $('#linkadd').click(function(){
                                    $('#spacelink').slideUp('low',function(){
                                        $('#formadd').slideDown('low');
                                    });
                                })

                                $('#lcancelf').click(function(){
                                    $('#formadd').slideUp('low',function(){
                                        $('#spacelink').slideDown('low');
                                    });
                                })
                                
                                idcategory = -1;
                                idsubcategory = -1;
                                var msgccategories='<?php echo $this->lang('dashboard_pages_txt_choosecategory')?>';
                                var msgcsubcategories='<?php echo $this->lang('dashboard_pages_txt_choosesubcategory')?>';
                                loadcategorypages(idcategory, msgccategories, msgcsubcategories, '#pagecategory', '#pagesubcategory');
                                loadsubcategorypages(idcategory, idsubcategory, msgcsubcategories, '#pagesubcategory');
                                var txt_choose_category='<?php echo $this->lang('dashboard_pages_error_choosecategory')?>';
                                var txt_choose_subcategory='<?php echo $this->lang('dashboard_pages_error_choosesubcategory')?>';
                                var txt_enter_title='<?php echo $this->lang('dashboard_pages_error_entertitle')?>';
                                var txt_enter_url='<?php echo $this->lang('dashboard_pages_error_enterurl')?>';
                                var txt_url_invalid='<?php echo $this->lang('dashboard_pages_error_urlnovalid')?>';
                                $('#bsave').click(function(){
                                    createPage('#msgerror', '#bsave');
                                    return false;
                                });
    
                                </script>
                                
                            </div>
                        
                    	</div>
                
                	</div>
        
        		</div>
        
        	</div>
        
        </div>
        
        <div id="divseparator" class="sh"></div>
        
        <div id="column3"><?php $this->load_template('_accessories-dashboard.php'); ?></div>
        
        <div class="sh"></div>
    
    </div>
            
</div>    

<?php
$this->load_template('_foot.php');
$this->load_template('_footer.php');
?>