Bueno, escribo de nuevo porque ya lo he resuelto y haber si a otro le puede valer la opción:
Código Javascript
:
Ver originaljQuery("#add_valoracion").dialog({
autoOpen: false,//remove this and the click to aut oopen
bgiframe: true,
dialogClass: "valor",
position: 'top:0',
height:1000,
width: 1300,
modal: true,
resizable: false,
buttons: {
'Cancelar': function() {
jQuery(this).dialog('close');
},
'Guardar': function() {
var html_valora = jQuery("#valoracion").contents().find("#jSheetEditPane_0_0").html();
var s = "";
jQuery(html_valora).each(function() {
s += compacta(this);
s = unescape(s);
});
var arra = s.split("\n");
var num = arra.length;
var ref = jQuery("#ref").val();
for (i=0; i < num; i++) {
tex = arra[i];
agrega(i, ref, tex);
}
jQuery(this).dialog('close');
}
},
open: function(event, ui) {
$('.valor').css('top', 20);
}
});
function agrega(i, ref,tex){
var url = "include/valoracion.php";
$.ajax({
type: "POST",
url: url,
data: "ref="+ref+"&html="+escape(tex),
success: function(msg){
},
error: function(msg){
alert(msg);
}
});
}
function compacta(node) {
var result = "";
if (node.nodeType == 1) {
result += "<" + node.tagName;
hasClass = false;
var n = node.attributes.length;
for (var i = 0, hasClass = false; i < n; i++) {
var key = node.attributes[i].name;
var val = node.getAttribute(key);
if (val) {
if (key == "contentEditable" && val == "inherit") {
continue;
// IE hack.
}
if (key == "class") {
hasClass = true;
}
if (typeof(val) == "string") {
result += " " + key + '="' + val.replace(/"/g, "'") + '"';
} else if (key == "style" && val.cssText) {
result += ' style="' + val.cssText + '"';
}
}
}
if (node.tagName == "COL") {
result += '/>';
} else {
result += ">";
var childResult = "";
jQuery(node.childNodes).each(function() {
childResult += HTMLtoCompactSource(this);
});
result += childResult;
result += "</" + node.tagName + ">";
}
} else if (node.nodeType == 3) {
result += node.data.replace(/^\s*(.*)\s*$/g, "$1");
}
return result;
}
y el siguiente php:
Código PHP:
Ver original<?php
$ref =$_POST["ref"];
$contenido = $_POST["html"];
$myFile = "../archivos/".$ref."/valoracion.html";
$fh = fopen($myFile, 'a') or
die("can't open file"); ?>
Al final lo que he hecho es recorrer el html de la tabla y parsearlo de manera correcta. Y la verdad queda de lujo!
Lo dicho espero que ha alguien le valga.
Un saludo y gracias por las contestaciones
masterpuppet
Eric