comparison php/save.php @ 3088:12b90c6ff910

WIP for #262
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 12 Jan 2018 12:16:27 +0000
parents a10cbbccc4f3
children 385bb2e03ab7
comparison
equal deleted inserted replaced
3087:39ffb48949de 3088:12b90c6ff910
87 $n2 = 0; 87 $n2 = 0;
88 } 88 }
89 $sn1 = findNodeByAttribute($n1, "location", "pre"); 89 $sn1 = findNodeByAttribute($n1, "location", "pre");
90 $sn2 = findNodeByAttribute($n2, "location", "pre"); 90 $sn2 = findNodeByAttribute($n2, "location", "pre");
91 if ($sn1 != 0) { 91 if ($sn1 != 0) {
92 if ($sn2 != 0 && $sn2.getAttribute("state") != "complete") { 92 if ($sn2 != 0) {
93 $saved_root->removeChild($sn2); 93 $saved_root->removeChild($sn2);
94 $sn2 = 0; 94 $sn2 = 0;
95 } 95 }
96 if ($sn2 == 0) { 96 if ($sn2 == 0) {
97 $sn1 = $doc->importNode($sn1->item(0), true); 97 $sn1 = $doc->importNode($sn1->item(0), true);
100 } 100 }
101 101
102 $sn1 = findNodeByAttribute($n1, "location", "post"); 102 $sn1 = findNodeByAttribute($n1, "location", "post");
103 $sn2 = findNodeByAttribute($n2, "location", "post"); 103 $sn2 = findNodeByAttribute($n2, "location", "post");
104 if ($sn1 != 0) { 104 if ($sn1 != 0) {
105 if ($sn2 != 0 && $sn2.getAttribute("state") != "complete") { 105 if ($sn2 != 0) {
106 $saved_root->removeChild($sn2); 106 $saved_root->removeChild($sn2);
107 $sn2 = 0; 107 $sn2 = 0;
108 } 108 }
109 if ($sn2 == 0) { 109 if ($sn2 == 0) {
110 $sn1 = $doc->importNode($sn1->item(0), true); 110 $sn1 = $doc->importNode($sn1->item(0), true);
122 } 122 }
123 foreach($n1 as $page) { 123 foreach($n1 as $page) {
124 $ref = $page->getAttribute("ref"); 124 $ref = $page->getAttribute("ref");
125 if (!empty($ref)) { 125 if (!empty($ref)) {
126 $pn2 = findNodeByAttribute($n2, "ref", $ref); 126 $pn2 = findNodeByAttribute($n2, "ref", $ref);
127 if ($pn2 != 0 && $pn2.getAttribute("state") != "complete") { 127 if ($pn2 != 0) {
128 $saved_root->removeChild($pn2); 128 $saved_root->removeChild($pn2);
129 $pn2 = 0; 129 $pn2 = 0;
130 } 130 }
131 if ($pn2 == 0) { 131 if ($pn2 == 0) {
132 $pn1 = $doc->importNode($page, true); 132 $pn1 = $doc->importNode($page, true);