<?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>
<script type="text/javascript" src="<?php echo $C->SITE_URL; ?>themes/<?php echo $C->THEME ?>/js/js_ajaxupload.js"></script>
<script type="text/javascript" src="<?php echo $C->SITE_URL; ?>themes/<?php echo $C->THEME ?>/js/js_uploadimage.js"></script>
<script type="text/javascript" src="<?php echo $C->SITE_URL; ?>themes/<?php echo $C->THEME ?>/js/js_uploadcover.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="listgroups">
                
                	<div class="boxdash">
                
                        <div class="title"><?php echo $this->lang('dashboard_groups_title')?></div>
                        
                        <div class="spaceinfo">
                        
                        	<?php $this->load_template('__dashboard-smenu-groups.php');?>
                            
                            <div class="mrg20T mrg30B">
                            
                            	<div class="txtsize08"><?php echo $this->lang('dashboard_groups_update_txt_title'); ?></div>
                                
                                <div id="formedit" class="mrg20T">                                
                                
									<div class="editarea">
                                    
                                    	<div class="subtitle"><?php echo $this->lang('dashboard_groups_update_txt_infobasic'); ?></div>
                    
			                            <div id="form01" class="mrg30B">
            			            		<form id="form1" name="form1" method="post" action="">
                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_groups_txt_namegroup')?>:</div>
                        					<div><input name="namegroup" type="text" id="namegroup" class="boxinput withbox" value="<?php echo $D->namegroup?>"/></div>

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

											<div class="mrg10T grey1"><?php echo $this->lang('dashboard_groups_txt_privacy')?></div>
                                            <div><select name="privacygroup" id="privacygroup" class="boxinput withbox" onchange="loadDetails(this.value, '#msgprivacy');">
                                            	<option value="0" <?php echo($D->privacy==0?'Selected':'')?>><?php echo $this->lang('dashboard_groups_txt_public')?></option>
                                            	<option value="1" <?php echo($D->privacy==1?'Selected':'')?>><?php echo $this->lang('dashboard_groups_txt_closed')?></option>
                                            	<option value="2" <?php echo($D->privacy==2?'Selected':'')?>><?php echo $this->lang('dashboard_groups_txt_secret')?></option>
                                            </select></div>
                                            <div id="msgprivacy" class="mrg5T"></div>
											<div id="msgok" class="yellowbox"></div>
                                            <div id="msgerror" class="redbox"></div>
                                            <div class="mrg20T mrg5B">
                                                <span><input type="submit" name="bsave" id="bsave" value="<?php echo $this->lang('dashboard_groups_update_txt_submitinfobasic')?>" class="bblue hand"/></span>
                                            </div>
                      
					                      </form>
                                        </div>
                                
                                    </div>
                                
                                
                                </div>                           
                            
								<script>
								function loadDetails(idmsg, divmsg) {
									idmsg = parseInt(idmsg);
									switch (idmsg) {
										case 0:
											$(divmsg).html('<?php echo $this->lang('dashboard_groups_txt_msgpublic');?>');
											break;	
										case 1:
											$(divmsg).html('<?php echo $this->lang('dashboard_groups_txt_msgclosed');?>');
											break;	
										case 2:
											$(divmsg).html('<?php echo $this->lang('dashboard_groups_txt_msgsecret');?>');
											break;
									}
								}
                                
								var cgroup = '<?php echo $D->codegroup?>';
                                loadDetails(<?php echo $D->privacy?>, '#msgprivacy');
                                var txt_enter_name='<?php echo $this->lang('dashboard_groups_error_entername')?>';
                                $('#bsave').click(function(){
                                    updateGroup('#msgerror', '#msgok', '#bsave');
                                    return false;
                                });
    
                                </script>
                                
                                
                                <div id="formeditcover" class="mrg40T">                                
                                
									<div class="editarea">
                                    
										<div class="subtitle"><?php echo $this->lang('dashboard_groups_update_txt_covergroup')?></div>
                                             
                                        <div id="form03" class="mrg10B">
                                             <form id="form3" name="form3" method="post" action="">
                                             
                                             <div class="grey1 mrg10T"><?php echo $this->lang('dashboard_groups_update_txt_msgcaption_cover')?></div>
                                             <div class="mrg10T"><img src="<?php echo !empty($D->covergroup)?$C->SITE_URL.$C->FOLDER_COVERS_GROUPS.'min3/'.$D->covergroup:''?>" id="prwimgCov" class="previewCoverdash"></div>
                                             <div class="mrg10T mrg10B"><span id="linkUpCover" class="onlyblue bold hand"><?php echo !empty($D->covergroup)?$this->lang('dashboard_groups_update_txt_cover_msg1'):$this->lang('dashboard_groups_update_txt_cover_msg0')?></span></div>
                                             <div>
                                                <div id="areapreloadCv" class="hide"><img src="<?php echo $C->SITE_URL?>themes/<?php echo $C->THEME ?>/imgs/preload.gif"/></div>
                                                <input name="loadedcover" type="hidden" id="loadedcover" value="<?php echo $D->covergroup?>" />
                                                <input name="didchangescov" type="hidden" id="didchangescov" value="0" />
                                             </div>
                    
                                            <div id="msgerror3" class="redbox"></div>
                                            <div id="msgok3" class="yellowbox"></div>
                                            <div class="mrg10T mrg5B">
                                                <input type="submit" name="bsave3" id="bsave3" value="<?php echo $this->lang('dashboard_groups_update_txt_submitcover')?>" class="bblue hand"/>
                                            </div>
                    
                                             </form>
                                             
                                        </div>
                                         
                                    </div>                                
                                
                                </div>

								<script>                         
                                var group_cov_msg1 = '<?php echo $this->lang('dashboard_groups_update_txt_cover_msg3')?>';
                                var group_cov_msg2 = '<?php echo $this->lang('dashboard_groups_update_txt_cover_msg2')?>';
                                var group_cov_msg3 = '<?php echo $this->lang('dashboard_groups_update_txt_cover_msg4')?>';
                                var foldercoversgroups = '<?php echo $C->FOLDER_COVERS_GROUPS?>';
                                $('#linkUpCover').uploadCover(1,'<?php echo $C->FOLDER_TMP?>','_covgroup_',group_cov_msg1,group_cov_msg2);
                                $('#bsave3').click(function(){
                                    updateCoverGroup('#msgerror3','#msgok3','#bsave3');
                                    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');
?>