<?php
	/*
	 *
	 * 2003 - 2021 @ Yal Publicidad - yPanel
	 * www.yalpublicidad.com
	 * online@yalpublicidad.com
	 *
	 * formulario de modulo
	 */
	
	/* Autorizo acceso */
		defined('YPANEL_INI') or die( 'No dispones de acceso' );
			
	global $plug;
	
	yPanel::incluir_css( "../css/styles.css" );
	yPanel::incluir_js( "../js/jsy-script.js" );
	
	if( isset( $_GET['extension'] ) ){
		// creo head de plugin
		$nomPlug	= explode( '|', plug::leerPlugConf( 'nombre' ) );
		$desPlug	= explode( '|', plug::leerPlugConf( 'descripcion' ) );
?>
		
		
		<!--div id="MsjBox" style="display:none"></div-->
		<div id="wy_modal"></div>
		
		<div class="row">
			<!-- Panel Principal -->
			<div class="col-sm-12">
				<h4><i class="fa fa-plug"></i> <?php echo plug_lng( $nomPlug[0], $nomPlug[1] ) ?></h4>
				<hr>
				<p><?php echo plug_lng( $desPlug[0], $desPlug[1] ) ?></p>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12">
				<div class="m-t-35 p-t-15 p-r-15 p-l-15 p-b-15">
				<?php
					// cargo plugin
						include_once( YPATH . YDS . 'wy_incluye' . YDS . 'wy_ext' . YDS . $_GET['extension'] . '/wy_' . $_GET['extension'] . '.php' );
				?>
				</div>
			</div>
		</div>
		<script type="text/javascript">
				<?php
				if( $plug->JS_b_nuevo ) echo 'var bNuevo = document.querySelector("button[name=nuevo]"); bNuevo.onclick = function(){ location.href=\'' . plug_ir_a( 'this', 'agregar' ) . '\'; }; ';
				if( $plug->JS_b_salir ) echo 'var bCerrar = document.querySelector("button[name=cerrar]"); bCerrar.onclick = function(){ location.href=\'' . ( isset( $_GET['acc'] ) ? plug_ir_a( 'this' ) : './' ) . '\'; }; ';
				?>
		</script>
		
		<script type="text/javascript">
			var $mbBody = document.getElementsByTagName("body")[0];
			var mb = document.createElement('div');
				mb.setAttribute('id','MsjBoxObs');
				mb.style.position = 'fixed';
				mb.style.bottom = '5%';
				mb.style.margin = '0 auto';
				mb.style.border = '1px solid #666';
				mb.style.borderRadius = '5px';
				mb.style.boxShadow = '0 3px 20px 0px rgba(0, 0, 0, 0.1)';
				mb.style.background = 'rgba(0,0,0,0.7)';
				mb.style.color = '#ffffff';
				mb.style.padding = '5px 15px';
				mb.style.zIndex = '2999';
				//				mb.innerHTML = '<span>uuuuuuuuuu</span>';				
				$mbBody.appendChild(mb);
				mWidth = ( ( WinSize('Width') / 2 ) - ( mb.clientWidth / 2 ) );
				mb.style.left = mWidth + 'px';
				mb.style.display = 'none';
			
			
			//var mb= document.getElementById('MsjBox');
			var mTimer;
			
			var wymdl = document.getElementById('wy_modal');
			
			function OcultarMsg(){		
				mb.style.display = 'none';
				pre_carga.style.display = 'none';
				clearInterval(mTimer);
			}
			
			function ocultar_vmodal(){
				wymdl.style.top = '-200vh';
				wymdl.innerHTML = '';
				document.body.style.overflowY = 'auto';
			}
			
			function btn_x_modal(){
				wymdl.innerHTML = '<input type="radio" id="wy_modal_btn_cerrar" name="modal" onClick="ocultar_vmodal()" /><label for="wy_modal_btn_cerrar">X</label>';	
			}
			
 
			function e_form( x ){
				var f = document.querySelector( x );
				f.method = 'POST';
				f.submit();
			}
			
			<?php 
				echo plug::obtener_js(); 
			?>
		</script>
		
<?php		
	}
?>