- Timestamp:
- 2013-01-11T18:27:42+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in
r26596 r26694 182 182 183 183 //url += "&p.showExpediteeAttributes=1"; 184 url += "&p.showAssocFilePath=1"; 184 185 185 186 … … 213 214 iframeDoc = iframe.contentWindow.document; 214 215 } 215 216 var frameID = (numDocOIDs - docOIDs.length); 217 var progressPercent = frameID/numDocOIDs * 100; 218 216 217 var xmlUrl = iframe.src + "&o=xml"; 218 219 var iter = (numDocOIDs - docOIDs.length); 220 var progressPercent = iter/numDocOIDs * 100; 221 222 /*Check if a frame-id metadata element already exists, 223 otherwise generate a new frame number based on the 224 number of documents to process.*/ 225 var frameNum = getMetadata(xmlUrl,'frameID'); 226 227 if(frameNum === null){ 228 frameNum = iter; 229 console.log("no frameNum found, use iter: " + frameNum); 230 }else{ 231 console.log("frameNum metadata found: " + frameNum); 232 } 233 219 234 \$(function() { 220 235 \$('#progressbar').progressbar({ value: progressPercent }) … … 228 243 var pxr = gsContentPos.xr; 229 244 */ 230 231 //get assocfilepath from xml 232 var xmlUrl = iframe.src + "&o=xml"; 233 234 var assoc = getAssocFilePath(xmlUrl); 245 246 //Check if an assocfilepath annotation already exists on the page, otherwise obtain it from the xml. 247 var assocElem = iframeDoc.getElementById('assocfilepath'); 248 var assoc = null; 249 250 if(assocElem === undefined || assocElem === null){ 251 assoc = getMetadata(xmlUrl,'assocfilepath'); 252 } 235 253 236 254 var expFrameTree = htmlToExpeditee(gsContent); … … 248 266 } 249 267 250 params += "&a=generate-frame&fn=" + frameID; 268 //params += "&a=generate-frame&fn=" + iter; 269 params += "&a=generate-frame&fn=" + frameNum; 251 270 params += "&json=" + escape(expFrame); 252 271 253 //add an assocfilepath parameter 254 255 if(assoc !== null && assoc !== undefined){ 272 //add an assocfilepath parameter but only if it is defined. 273 if(assoc !== null){ 256 274 params += "&assoc=" + assoc; 257 275 } … … 288 306 289 307 //url += "&p.showExpediteeAttributes=1"; 290 291 iframe.src = url; 308 url += "&p.showAssocFilePath=1"; 309 310 iframe.src = url; 292 311 } 293 312 else { 294 295 296 297 298 313 var progressbar = document.getElementById("progressbar"); 314 progressbar.style.display = "none"; 315 316 iframe.style.display = "none"; 317 delete iframe.src; 299 318 } 300 319 } … … 302 321 } 303 322 304 function getAssocFilePath(xmlUrl){ 305 var assoc = ""; 323 /** 324 * Once this is working, remove getAssocFilePath method 325 * This method is used at this stage to retrieve assocfilepath 326 * and frame number metadata values from the document's xml. 327 **/ 328 function getMetadata(xmlUrl,nameValue){ 306 329 307 \$.ajax({ 330 var metadata = null; 331 332 \$.ajax({ 308 333 type: "GET", 309 334 async: false, … … 317 342 var name = \$(this).attr('name'); 318 343 319 if(name === 'assocfilepath'){320 if( assoc === ""){321 assoc= \$(this).text();322 //console.log( assoc);344 if(name === nameValue){ 345 if(metadata === null){ 346 metadata = \$(this).text(); 347 //console.log(metadata); 323 348 } 324 349 … … 329 354 330 355 }); 331 332 return assoc;356 357 return metadata; 333 358 } 334 359
Note:
See TracChangeset
for help on using the changeset viewer.