Ejemplo/parte 2
Código PHP:
require_once("../xajax0.5_E/xajax_core/xajax.inc.php");
$xajax = new xajax();
//XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php
//XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php
//XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php
//XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php
//XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php //XAJAXTemas.php
$xajax->register(XAJAX_FUNCTION,'FnXAJAX_Temas_Editar1');
$xajax->register(XAJAX_FUNCTION,'FnXAJAX_Temas_Eliminar1');
$xajax->register(XAJAX_FUNCTION,'FnXAJAX_Temas_MostrarLista');
$xajax->register(XAJAX_FUNCTION,'FnXAJAX_Temas_Mover1');
$xajax->register(XAJAX_FUNCTION,'FnXAJAX_Temas_Nuevo1');
$xajax->register(XAJAX_FUNCTION,'FnXAJAX_VSposT_Cambiar');
function FnXAJAX_Temas_Editar1($form){
$objResponse = new xajaxResponse();
$POS = $_SESSION['VSposT'];
//$form = xajax.getFormValues('form_MENU');
//$pagina = htmlspecialchars($form['txt_pagina']);
if ($POS>=0){
$nombre = htmlspecialchars(trim($form['txt_nombre']));
$pagina = htmlspecialchars(trim($form['txt_pagina']));
$_SESSION['VStemas'][$POS]["nombre"] = $nombre;
$_SESSION['VStemas'][$POS]["pagina"] = $pagina;
$objResponse->assign('div_Titulo_'.$POS,'innerHTML', $nombre);
}
return $objResponse;
}
function FnXAJAX_Temas_Eliminar1(){
$objResponse = new xajaxResponse();
$TAM = FnPHP_Lista_Tam($_SESSION['VStemas']);
if ($_SESSION['VSposT'] <> -1){
$_SESSION['VStemas'] = FnPHP_Temas_Eliminar1($_SESSION['VStemas'], $_SESSION['VSposT']);
if($_SESSION['VSposT'] == $TAM-1){
$_SESSION['VSposT']--;
}
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
}
return $objResponse;
}
function FnXAJAX_Temas_MostrarLista(){
$objResponse = new xajaxResponse();
$N = FnPHP_Lista_Tam($_SESSION['VStemas']);
$POS = $_SESSION['VSposT'];
for ($i=0; $i<$N; $i++){
$margen = $_SESSION['VStemas'][$i]["margen"];
$Id_tema= $_SESSION['VStemas'][$i]["Id_tema"];
$nombre = $_SESSION['VStemas'][$i]["nombre"];
$pagina = $_SESSION['VStemas'][$i]["pagina"];
$indice = $_SESSION['VStemas'][$i]["indice"];
$numero = $i;
if (($i==$POS) and ($POS<>-1)){
$newContent .='<div id="div_Fila_'.$i.'" name="div_Fila_'.$i.'" class="EstiloDIV_1">';
$newContent .= FnPHP_Temas_CrearFisico1($margen, $Id_tema, $nombre, $pagina, $indice, $i, 1).'</div>';
}else{
$newContent .='<div id="div_Fila_'.$i.'" name="div_Fila_'.$i.'" class="EstiloDIV_0">';
$newContent .= FnPHP_Temas_CrearFisico1($margen, $Id_tema, $nombre, $pagina, $indice, $i, 0).'</div>';
}
}
$objResponse->assign('div_MAIN' ,'innerHTML', $newContent);
$objResponse->assign('txt_nombre','value', $_SESSION['VStemas'][$POS]["nombre"]);
$objResponse->assign('txt_pagina','value', $_SESSION['VStemas'][$POS]["pagina"]);
return $objResponse;
}
function FnXAJAX_Temas_Mover1($DIR){
$objResponse = new xajaxResponse();
$POS = $_SESSION['VSposT'];
$TAM = FnPHP_Lista_Tam($_SESSION['VStemas']);
if ($POS>=0){
$margen = $_SESSION['VStemas'][$POS]["margen"];
switch($DIR){
case "izq":
if ($margen > 1){
$margen--;
$_SESSION['VStemas'][$POS]["margen"] = $margen;
$objResponse->assign('txt_Indice_'.$POS,'value', "");
$objResponse->assign('span_Margen_'.$POS,'innerHTML', FnPHP_Temas_Margen($margen));
$objResponse->assign('div_Titulo_'.$POS,'className', FnPHP_Temas_CSS($margen));
}
break;
case "der":
$margen++;
$_SESSION['VStemas'][$POS]["margen"] = $margen;
$objResponse->assign('txt_Indice_'.$POS,'value', "");
$objResponse->assign('span_Margen_'.$POS,'innerHTML', FnPHP_Temas_Margen($margen));
$objResponse->assign('div_Titulo_'.$POS,'className', FnPHP_Temas_CSS($margen));
break;
case "arr":
if($POS>0){
$_SESSION['VStemas'] = FnPHP_Temas_Intercambiar2($_SESSION['VStemas'], $POS, $POS-1);
$_SESSION['VSposT']--;
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
}
break;
case "aba":
if($POS<$TAM-1){
$_SESSION['VStemas'] = FnPHP_Temas_Intercambiar2($_SESSION['VStemas'], $POS, $POS+1);
$_SESSION['VSposT']++;
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
}
break;
default:
break;
}
}
return $objResponse;
}
function FnXAJAX_Temas_Nuevo1(){
$objResponse = new xajaxResponse();
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
$TAM = FnPHP_Lista_Tam($_SESSION['VStemas']);
if($_SESSION['VSmodo'] == 1){
$objResponse->script("xajax_FnXAJAX_Temas_CrearDivsNull();");
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
}
if($_SESSION['VSposT'] == -1 and $TAM > 0){
$_SESSION['VSposT'] = $TAM-1;
}
$_SESSION['VStemas'] = FnPHP_Temas_Nuevo1($_SESSION['VStemas'], $_SESSION['VSposT']);
$_SESSION['VSposT']++;
$objResponse->assign('txt_nombre','value', "");
$objResponse->assign('txt_pagina','value', "");
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
return $objResponse;
}
function FnXAJAX_VSposT_Cambiar($POS){
$objResponse = new xajaxResponse();
if ($_SESSION['VSposT']<>$POS){
$_SESSION['VSposT']=$POS;
}else{
$_SESSION['VSposT']=-1;
}
$objResponse->script("xajax_FnXAJAX_Temas_MostrarLista();");
return $objResponse;
}
$xajax->configure('responseQueueSize',10000);
$xajax->processRequest();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Indices del curso</title>
<?PHP $xajax->printJavascript('../xajax0.5_E/'); ?>
<script type="text/javascript" src="../JS/DD/SimpleTreeMenu.js">
/***********************************************
* Simple Tree Menu- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<link rel="stylesheet" type="text/css" href="../JS/DD/SimpleTreeMenu.css" />
<link rel="stylesheet" type="text/css" href="../CSS/CSS_000.css" />
<style type="text/css">
<!--
body {
background:#000099
}
.Boton_00 {
}
.Titulo_01 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 20px;
color: #000000;
}
.Titulo_02 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 18px;
color: #000000;
}
.Titulo_03 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 16px;
color: #000000;
}
.Titulo_04 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 14px;
color: #000000;
}
.Titulo_05 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 12px;
color: #000000;
}
.Titulo_06 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 10px;
color: #000000;
}
.Menu_encabezado {
font-size: 21px;
font-weight: bold;
color: #FF0000;
}
.Margen_01 {
font-family: "Courier New", Courier, monospace;
font-weight: bold;
font-size: 10px;
color: #000000;
}
.Opciones_01 {
font-family: "Times New Roman", Times, serif;
font-weight: bold;
font-size: 14px;
color: #FFFFFF;
}
.EstiloDIV_0 {
background:#FFFFFF;
}
.EstiloDIV_1 {
background:#CCCCCC;
}
.EstiloDIV_Menu {
height:150px;
overflow:auto;
background:#FFFFFF;
}
.EstiloDIV_Main {
height:500px;
overflow:auto;
background:#FFFFFF;
}
-->
</style>
</head>